Hello, Please if anyone knows how to make this work help me, I have been trying this for a long time.
I want whenever car part touches other part it should give value = 1 but when touch ends it should give the value = 0
This script is not working, I am just showing
local part = game.Workspace.Park
local function onTouch(otherPart)
if otherPart == part and game.Workspace.Park.first.Value == 0 then
print("Touch started: " .. otherPart.Name)
wait(0.1)
game.Workspace.Park.first.Value = 1
end
end
local function onTouchEnded(otherPart)
if otherPart == part and game.Workspace.Park.first.Value == 1 then
print("Touch ended: " .. otherPart.Name)
wait(0.1)
game.Workspace.Park.first.Value = 0
end
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)