Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Plane gui motor?

Asked by 9 years ago

i have made an engine and i want it when you press on a gui to make it to start to spin i add a motor and the motor is truned off and can someone help me fix the script for it?

local Motor = script.Parent.Parent.Parent.Workspace.MOTOR.BackSurfaceInput


function onClicked
    Motor = "Constant"
end 
0
You are missing Parentheses. woodengop 1134 — 9y
0
what you mean? manpooboy 0 — 9y

1 answer

Log in to vote
0
Answered by
unmiss 337 Moderation Voter
9 years ago

I'm not sure what to say about how your script works as you haven't really provided much, but for functions, regardless of the existence of arguments or not, you still need dual parenthesis after your function keyword, such as function name(), rather than function name. Otherwise, the Lua interpreter will fail.

Fixed:

local Motor = script.Parent.Parent.Parent.Workspace.MOTOR.BackSurfaceInput

function onClicked()
    Motor = "Constant"
end 

You should also define your BSI when you change it, or you could experience an error. And why not use game.Workspace.MOTOR rather than a line of parents?

Fixed again:

local Motor = game.Workspace.MOTOR

function onClicked()
    Motor.BackSurfaceInput = "Constant"
end 

Also, how are you calling this function? Is this all of your script, or is just a snippet you need help with?

0
It's much easier to do game.Workspace or better yet, workspace. Spongocardo 1991 — 9y
0
Didn't see that. Edited into my answer. unmiss 337 — 9y
0
non of them seem to work manpooboy 0 — 9y
0
My script works; but you need to provide your other code if it doesn't work. Clearly something else must call this function for it to work. unmiss 337 — 9y
Ad

Answer this question