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
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?