I made a server script where if the model touches the crowbar part named "touch", a value inside of it named "Prisoner" will changed to true or false depending on if it's already false or true :
local debounce = false
local debounce_delay = 1
local part = script.Parent.Touch
part.Touched:Connect(function(hit)
if not debounce then
debounce = true
if hit ~= nil then
if hit.Parent then
if hit.Parent.Name == "Dummy" then
print("It's dummy")
local player = hit.Parent
if player:FindFirstChild("Prisoner") then
local Prisoner = player.Prisoner
if Prisoner:IsA("BoolValue") then
if Prisoner.Value == true then
Prisoner.Value = false
print("Changed to false")
elseif Prisoner.Value == false then
Prisoner.Value = true
print("Changed to true")
end
end
end
end
end
end
wait(debounce_delay)
debounce = false
end
end)
The model is named "Dummy" and is inside the workspace
