This is what I've made
bridge = script.Parent.Parent.bridge function onTouched() bridge.CanCollide = true bridge.Transparency = 0 end script.Parent.Touched:connect(onTouched)
but I want it to do this
bridge = script.Parent.Parent.bridge if function onTouched() == false then bridge.CanCollide = true bridge.Transparency = 0 else bridge.CanCollide = false bridge.Transparency = 1 end script.Parent.Touched:connect(onTouched)
local bridge = script.Parent.Parent.bridge local function onTouch(part) bridge.CanCollide = true bridge.Transparency = 0 end local function onTouchEnded(part) bridge.CanCollide = false bridge.Transparency = 1 end bridge.Touched:Connect(onTouch) bridge.TouchEnded:Connect(onTouchEnded)
This is what I came up with