How to make people not be able to reset in room?

So, I have a question. How would I make it so that if I put a user inside of a room, it will not let them reset? I am using this for a jail system and I am assuming you would use a part that makes it so when you touch it, it disables resetting but I was wondering on how I can do this.

Insert a Local Script in StaterGui, a part in Workspace and in the script paste this

local starterGui = game:GetService("StarterGui")

game.Workspace.No_Reset.Touched:Connect(function()

starterGui:SetCore("ResetButtonCallback", false)

end)

game.Workspace.No_Reset.TouchEnded:Connect(function()

starterGui:SetCore("ResetButtonCallback", true)

end)

(No_Reset is the part name)

You could use Region3 to create a region, this region being the room and check if the player is in the region by using Workspace:FindPartsInRegion3 (there are variants of this).

It would be as simple as checking if they are if the region, and if they are fire a remote event that passes true or false to the client.

If it is true (they are in the region):
game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)

And if it is false (they are no longer in the region):
game:GetService("StarterGui"):SetCore("ResetButtonCallback", true)
This remote event would be in a local script somewhere in the player and would be called whenever they enter the region succesfully.

This should allow you to easily disable and re-enable it at will.

1 Like

I wouldn’t recommend using TouchEnded, it can work extremely wonky & fragile and you would call the event in a numerous & unnecessary amount of times

I believe that Region3 would be a better approach for this (As stated in the previous post)

1 Like

So if I did this, would it work?

Image:

I made this and it works but when you sit in a seat, it allows you to still reset. Is there anyway to fix this?