I am trying to make a script where if a player is on a part, it disables reset for 60 seconds. How can I do this? I have tried but I can’t do it.
1 Like
One thing you could do is create a server script that triggers when the player touches the part, send an event to the specific client, and have the client disable their reset.
local StarterGui = game:GetService('StarterGui')
wait()
StarterGui:SetCore("ResetButtonCallback",false)
The basic(localScript)
like @Ozxeb said, use RemoteEvent so it much secure instead.
I’m sorry, how do I get events from a player
1 Like
I have some code, unsure if this is correct…
game.ReplicatedStorage.Disable.OnClientEvent:Connect(function(plr)
local StarterGui = game:GetService('StarterGui')
StarterGui:SetCore("ResetButtonCallback",false, plr)
end)```
OnClientEvent()
doesn’t have a Player
parameter, nor does SetCore()
.
The proper way would be this.
local StarterGui = game:GetService('StarterGui')
game.ReplicatedStorage.Disable.OnClientEvent:Connect(function()
StarterGui:SetCore("ResetButtonCallback",false)
end)
game.ReplicatedStorage.Enable.OnClientEvent:Connect(function()
StarterGui:SetCore("ResetButtonCallback",true)
end)
No need for any player variables on client
Why use 2 separate events if you can fire just 1 from server with a boolean argument?
1 Like