Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i disable the reset button for one player?

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:

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

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

1 answer

✓ Accepted answer

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:

local event = game:GetService("ReplicatedStorage").RemoteEvent
local debounce = false
script.Parent.Touched:Connect(function(hit)
	if debounce == false then
		debounce = true
		if hit.Parent:FindFirstChild("Humanoid") then
			local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			event:FireClient(player)
		end
	end
	wait(5)
	debounce = false
end)

Local script:

local gui = game:GetService("StarterGui")
local reset = false

function ToggleReset()
	if reset == false then
		gui:SetCore("ResetButtonCallback", false)
		reset = true
	else 
		gui:SetCore("ResetButtonCallback", true)
		reset = false
	end
	
end

game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(ToggleReset)

1 comment

1

Thank you so much it works!

This discussion is preserved as it was. New answers, comments, and votes are closed.