I have created a script where the platform will turn red when a vehicle is present on it. This is to prevent unwanted spamming and such. The problem is that while the platform detects the presence of a vehicle on top of it, it cannot revert back to its original color afterwards (when there isn't a vehicle on it). It is only reverted back when a non-child touches it, but I want it so that it updates automatically without such.
function onTouch(object)
local Vehicle = object.Parent:FindFirstChild("VehicleSeat")
if (Vehicle ~= nil) then
script.Parent.BrickColor = BrickColor.Red()
elseif (Vehicle == nil) then
script.Parent.BrickColor = BrickColor.Gray()
end
end
game.workspace.Part.Touched:Connect(onTouch)

1 comment
Hey, if this help you, you can help me back by accept my answer.