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

How do i disable the reset button for one player?

Asked by 2 years ago
Edited 2 years ago

I'm using this script so that a player cant reset in a specific area, i also tried making it a local script but it just disables it for everyone:

1game.Workspace.epicpart.Touched:Connect(function()
2    game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
3    wait(34)
4    game:GetService("StarterGui"):SetCore("ResetButtonCallback", true)
5end)

So, is there any way to disable the reset button just for one player?

1 answer

Log in to vote
2
Answered by
ultrabug 306 Moderation Voter
2 years ago

Here's something I threw together that seems to work for this. So, the call actually has to be made from a local script, and as long as that local script's function only runs for the specific player that you want then it should work. The way I did this was by having a script in the part that gets touched, a remote event that the script and the local script can access, and a local script. The script detects the hit, and then works out which player it needs to fire the remote event for. The local script waits until it gets fired(which only happens for the specific player's version of the local script) and then toggles the reset thing.

Script code:

01local event = game:GetService("ReplicatedStorage").RemoteEvent
02local debounce = false
03script.Parent.Touched:Connect(function(hit)
04    if debounce == false then
05        debounce = true
06        if hit.Parent:FindFirstChild("Humanoid") then
07            local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
08            event:FireClient(player)
09        end
10    end
11    wait(5)
12    debounce = false
13end)

Local script:

01local gui = game:GetService("StarterGui")
02local reset = false
03 
04function ToggleReset()
05    if reset == false then
06        gui:SetCore("ResetButtonCallback", false)
07        reset = true
08    else
09        gui:SetCore("ResetButtonCallback", true)
10        reset = false
11    end
12 
13end
14 
15game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(ToggleReset)
1
Thank you so much it works! hellmet1 42 — 2y
Ad

Answer this question