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
 

Re: Change velocity of a part through a ClickDetector?

Previous Thread :: Next Thread 
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 06:35 AM
So I want to have a button which, when you click it, changes a seperate part called conveyor14 to velocity -30,0,0. I put this script in my button:

function onClicked(playerWhoClicked)
game.Workspace.conveyor14.Velocity = -30,0,0
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

and yes, the scripts parent is the clickdetector. However, it is not changing conveyor14's velocity? How can I do this?
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
19 Mar 2017 06:39 AM
If the script is in the click detector why did you do "script.Parent.ClickDetector"? It should just be script.Parent.
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 06:43 AM
Still doesn't work when I change it to script.Parent.....
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 06:53 AM
This is what output says:

11:52:57.329 - Workspace.Part.ClickDetector.Script:2: bad argument #3 to 'Velocity' (Vector3 expected, got number)
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
19 Mar 2017 07:06 AM
You have to use Vector3.new(-30,0,0) I think.
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 07:17 AM
It doesn't work still! No error output this time however...
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
19 Mar 2017 07:18 AM
You've done this?

function onClicked(playerWhoClicked)
game.Workspace.conveyor14.Velocity = Vector3.new(-30,0,0)
end

script.Parent.ClickDetector.MouseButton1Down:connect(onClicked)
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 07:22 AM
Yes, that isn't working either? No error output again..
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
19 Mar 2017 07:25 AM
MouseButton1Down cant be connected from a clickdetector...
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 07:26 AM
What do I need to put then? My scripting knowledge is very little..
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
19 Mar 2017 07:31 AM
Like what you did,

script.Parent.ClickDetector.MouseClick:connect(onClicked)

I automatically corrected it into a GUI cuz that's all I've been doing lately, sorry. :p
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 07:36 AM
I haven't a clue what I'm doing wrong but it's not working at all :/
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 08:13 AM
I've tried changing the name of the conveyor but it still isn't working. Any ideas?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
19 Mar 2017 08:14 AM
It should work, I have no idea what you're doing wrong, look, this one I made works fine:

https://www.roblox.com/library/701960817/Conveyor-Button
Report Abuse
OneFatDollar is not online. OneFatDollar
Joined: 27 Apr 2014
Total Posts: 65
19 Mar 2017 08:35 AM
Copied and pasted the scripts from your model and all working now! Very strange but thank you very much ;D
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