generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

.Changed event, need help.

Previous Thread :: Next Thread 
mrseth101 is not online. 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 is not online. 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 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
22 Apr 2017 09:55 AM
you are using it incorrectly********


Report Abuse
mrseth101 is not online. 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 is not online. 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 is not online. mrseth101
Joined: 09 Jan 2012
Total Posts: 36
22 Apr 2017 10:53 AM
if not debounce and part.Position == position then
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image