|
| 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
|
  |
| 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 |
|
|
|
| 19 Mar 2017 06:43 AM |
| Still doesn't work when I change it to script.Parent..... |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 19 Mar 2017 07:17 AM |
| It doesn't work still! No error output this time however... |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 19 Mar 2017 07:22 AM |
| Yes, that isn't working either? No error output again.. |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2017 07:25 AM |
MouseButton1Down cant be connected from a clickdetector...
|
|
|
| Report Abuse |
|
|
|
| 19 Mar 2017 07:26 AM |
| What do I need to put then? My scripting knowledge is very little.. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|