Cancel reset button when player touches part

Hello devs, I’m trying to make a good anti-reset system for my game, so whenever a player is touching a part, it would cancel their reset button using ResetButtonCallback.

I’ve tried many things and I still can’t get it right, I am still a beginner, so this is pretty new for me.

Any help is appreciated.

1 Like

So, whenever a player touches a part, they can’t reset from the menu button (Esc+R+Enter)?

Yes, that is what I’m trying to do.

game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)

But I don’t know how to make this a script inside a part that fires when a player touches it.

dont worry, i got you bro :wink: :

local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local part = workspace:WaitForChild("YourPartName") -- Replace "YourPartName" with the name of your part

-- Function to enable or disable the reset button
local function setResetButton(enabled)
    StarterGui:SetCore("ResetButtonCallback", enabled and true or false)
end

-- Monitor when players touch or leave the part
part.Touched:Connect(function(hit)
    local character = hit.Parent
    if character and Players:GetPlayerFromCharacter(character) then
        setResetButton(false) -- Disable reset button
    end
end)

part.TouchEnded:Connect(function(hit)
    local character = hit.Parent
    if character and Players:GetPlayerFromCharacter(character) then
        setResetButton(true) -- Re-enable reset button
    end
end)

1 Like

Thank you! It’s working very well.

1 Like

No Problem!!! Hope you make a succesful game!!!

Do not give up :happy4: !!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.