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

What is wrong with this TextButton clicked script?

Asked by
itsJooJoo 195
8 years ago

So basically, when somebody clicks a textbutton, I want it to clone a dance floor from serverstorage and make a red-tinted screen. This should be on the server, I don't want it to be on one client. Here is the script I put below inside the textbutton (in a ServerScript)

function onClicked()
    game.ServerStorage.DanceFloor:clone().Parent = workspace
    local color = Instance.new('ColorCorrectionEffect', game.Lighting)
    color.TintColor = Color3.fromRGB(255, 172, 172)
end

script.Parent.MouseButton1Down:connect(onClicked)

In studio, it works. But in the game, it doesn't. I know most guis are powered from LocalScripts, but this is supposed to affect everyone so I tried a regular Script. What did I do wrong? How can I fix this?

1 answer

Log in to vote
0
Answered by 8 years ago

The type of script does not relate to who the script effects. In order for the MouseButton1Down event to work, I believe you will need to be using a LocalScript. The rest of the code should work fine if filteringenabled is OFF, although if it's on then this will only affect the local player.

You can bypass this by using remoteevents, although that's a whole new question entirely.

0
If it's local it won't be able to access ServerStorage Pyrondon 2089 — 8y
0
I know, I moved it to ReplicatedStorage itsJooJoo 195 — 8y
0
That too, lol, can't believe I didn't notice that. Thanks darkelementallord 686 — 8y
Ad

Answer this question