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

?Scripts in local objects seem to not work

Asked by 3 years ago
Edited 3 years ago

So there's a box, a button that resets the box, a door and a button that opens that door. Everything works perfectly in normal conditions but I need these objects to be local in order to prevent chaos with multiple people. The problem is that when I tested, scripts inside those local objects stop working. Neither of the buttons work. I tried changing the regular script to a local one but nothing changed. I have no idea what to do...

Since it was asked I will also include this: (it works but only when created by the server)

script.Parent.ClickDetector.MouseClick:Connect(function()

    script.Parent.Texture.Color3 = script.Parent.charged.Value
    script.Parent.platform.Value.Texture.Color3 = script.Parent.charged.Value

    wait(.2)

    script.Parent.Texture.Color3 = script.Parent.off.Value
    script.Parent.platform.Value.Texture.Color3 = script.Parent.off.Value

    script.Parent.cube.Value.CFrame = script.Parent.platform.Value.CFrame + Vector3.new(0,6,0)

end)
0
Show us your script. Soban06 410 — 3y
0
It's not a script thing it's the execution. As I said, it works perfectly when the objects are created on server and not on client. Terrrrrrrra 0 — 3y
0
You can't use LocalScripts inside objects that are not on the client, parent the LocalScript to the client and change the code to fit your uses Spjureeedd 385 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

There are things only visible in the client. and there ar ethings visible among everything. To make a script what only works in the client, do it in a localscript! You can connect a local script to a normal one by using remoteevents. Hope i was able to help!

0
I already knew this, and I already tried using local scripts, the problem is that the buttons and doors are individual to each player. You did give me some ideas of how to deal with it so I will say thank you. :? Terrrrrrrra 0 — 3y
Ad

Answer this question