✓ Accepted answer
You cannot access PlayerGui from the server. You should change anything on ClientSide from your LocalScript that fires the server. Also, you should get the value when firing the server so the server can read your BoolValue. Also, you should set .Value of the object to false not set the object to false, along with checking the value. Although this may not be the best solution due to exploiters, you should probably have something ServerSide like a ClickDetector or something for them to click instead of whatever you're using.
ServerScript:
game.ReplicatedStorage.ModeEvents.TynReleaseEvent.OnServerEvent:Connect(function(plr, sentBool)
if sentBool == false then
if plr.Character:WaitForChild('Torso'):FindFirstChild('TynReleaseEffect') then return print('Player already has effect in Torso.') end
local eff = game.ReplicatedStorage.ModeEffects.TynReleaseEffect:Clone()
local char = plr.Character.Torso
eff.Parent = char
else
print("Mode Already Active")
end
end)
LocalScript:
game.ReplicatedStorage.ModeEvents.TynReleaseEvent:FireServer(game.Players.LocalPlayer.PlayerGui.ModeActive.Value)
game.Players.LocalPlayer.PlayerGui.ModeActive.Value = true
Let me know in the comments if you have any issues or questions.
1 comment
Thanks for catching the fact I was setting the object to false, oof. They click on a GUI button, and it changes their mode. Any suggestions to prevent exploiters from overlapping modes?