So, i have this script that toggles a trail in my game. There's a version of the script for two different trails, and a toggle all, in case that changes anything. I want to make it a server script, so everyone can see when someone toggles their trail.
local gui = script.Parent
local button = gui.ImageButton
local frame = gui.Frame
local function onClick() -- Create the function
if frame.Visible == true then -- If the frame is seen, disable the visibility, otherwise enable it.
frame.Visible = false
else
frame.Visible = true
end
end
button.MouseButton1Click:connect(onClick) -- onClick is the function name. MouseButton1Click is the event.

2 comments
I have changed it to a character script, but a get a nil error with 'Character.'
is it attempt to index nil with Character if yes then check if game.players.localplayer is there if its a localscript