mrseth101
|
  |
| Joined: 09 Jan 2012 |
| Total Posts: 36 |
|
|
| 22 Apr 2017 09:50 AM |
Just typed this up but doesn't seem to be working. I need a brick ("Part") to change its position when a certain brick (In my case, the ("Center") brick) reaches a specific position (-244.95, 10.7, 73.85) in the Workspace. How can this be accomplished?
Please inform me where the problem is, Here's what i'm working with: ------------------------------------------------------ cen = game.Workspace.Elevator.Elevator.Center.Position (-244.95, 10.7, 73.85) sp = script.Parent cen.Changed:connect(function() for i = 1, 30 do sp.CFrame = CFrame.new(sp.Position + Vector3.new (0, 0, 0.2)) end end) ------------------------------------------------------
Much thanks!
|
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 22 Apr 2017 09:54 AM |
Part Position does not have a .Changed argument, you are using it correctly.
Also () is exclusive to functions, Position(-244.95,10.7,73.85) doesn't work because Position is a Vector3 value, not a function.
You are probably looking for something like this:
local part = workspace.Elevator.Elevator.Center local position = part.Position local debounce
part.Changed:Connect(function() if not debounce and part.Position ~= position then debounce = true local sp = script.Parent for i=1,30 do sp.CFrame = sp.CFrame + Vector3.new(0,0,0.2) wait() end debounce = false end end)
|
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 22 Apr 2017 09:55 AM |
you are using it incorrectly********
|
|
|
| Report Abuse |
|
|
mrseth101
|
  |
| Joined: 09 Jan 2012 |
| Total Posts: 36 |
|
|
| 22 Apr 2017 10:08 AM |
| Well thanks! But! This seems to fire whenever the Center brick moves, I need it to fire when the Center brick reaches a certain Position.. Any ideas? |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 22 Apr 2017 10:19 AM |
there is a bit that has ~= change it to ==
|
|
|
| Report Abuse |
|
|
mrseth101
|
  |
| Joined: 09 Jan 2012 |
| Total Posts: 36 |
|
|
| 22 Apr 2017 10:53 AM |
| if not debounce and part.Position == position then |
|
|
| Report Abuse |
|
|