|
| 17 Aug 2011 03:03 PM |
Basically it starts out by checking if the script is already running through the Activated value, then proceeds to move the part 22 studs.
The thing is, I can't even get it to print out the "Touched" message so I'm guessing there's something wrong with structure.
function onTouched() print("Touched") if script.Parent.Activated.Value = false then script.Parent.Activated.Value = true print("About to move") for i=1, 22 do script.Parent.CFrame = script.Parent.CFrame.X - 1 wait(1) end print("Done") end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
Fl0x
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 5169 |
|
|
| 17 Aug 2011 03:05 PM |
script.Parent.CFrame = script.Parent.CFrame.X - 1 Error thar |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 03:05 PM |
Hey, I know you from another website. ;)
I only see two ends in there. There needs to be three. |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 04:36 PM |
"script.Parent.CFrame = script.Parent.CFrame.X - 1"
How exactly would I write it?
~roblox.com/CotF-item?id=370141 |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 04:53 PM |
Bump. I've added a third end but it still doesn't seem to be reacting at all.
~roblox.com/CotF-item?id=370141 |
|
|
| Report Abuse |
|
|
Ganondude
|
  |
| Joined: 22 Jun 2007 |
| Total Posts: 1175 |
|
|
| 17 Aug 2011 04:56 PM |
| If you want to set a part's CFrame you must set it to a value of type CFrame; you are attempting to set a part's CFrame to a single number. |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 17 Aug 2011 04:58 PM |
| if script.Parent.Activated.Value = false then --you need two '=' characters |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 17 Aug 2011 05:07 PM |
CFrame.X is read only, you would use
script.Parent.CFrame*CFrame.new(1,0,0) |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 05:18 PM |
'if script.Parent.Activated.Value = false then'
Should be:
'if script.Parent.Activated.Value == false then' |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 05:26 PM |
Here's how my script is turning out so far:
function onTouched() print("Touched") if script.Parent.Activated.Value == false then script.Parent.Activated.Value = true print("About to move") for i=1, 22 do script.Parent.CFrame = script.Parent.CFrame + CFrame.new(1,0,0) wait(1) end print("Done") end end
script.Parent.Touched:connect(onTouched)
Like was pointed out I had overlooked the double equal signs, but I'm still not really sure how I'd make it so script.Parent.CFrame = script.Parent.CFrame + 1 to the X vector.
Here's what is says in the output:
Workspace.Part.Script:7: bad argument #3 to '?' (CFrame expected, got number) |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 05:38 PM |
bump
~roblox.com/CotF-item?id=370141 |
|
|
| Report Abuse |
|
|
Ganondude
|
  |
| Joined: 22 Jun 2007 |
| Total Posts: 1175 |
|
|
| 17 Aug 2011 06:07 PM |
You can't add two CFrames, but you can add a Vector3 to a CFrame to translate the CFrame along world coordinates. For example,
part.CFrame = part.CFrame + Vector3.new(1,0,0)
This line would move part by 1 unit along the global x-axis. |
|
|
| Report Abuse |
|
|
|
| 17 Aug 2011 06:14 PM |
Thanks for the help, I think I've got it working.
/Thread Closed
~roblox.com/CotF-item?id=370141 |
|
|
| Report Abuse |
|
|