Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why does my onTouched cause my other code to stop working?

Asked by 5 years ago

I am attempting to make a car anti-theft so people cant steal it. I have to use a onTouched to make it work but it messes up other code parented into the seat

heres the code:

local seat = script.Parent

local car = seat.Parent

local carowner = seat.CarOwner



function onTouched(part)

if part.Name == "Left Leg" then

local h = part.Parent:FindFirstChild("Humanoid")

if (h ~= nil) then

carowner.Value = h.Parent.Name

end

end

end





script.Parent.Touched:connect(onTouched)
0
I don't see any problems here. What script is not working because of this? elitekiller2342 87 — 5y
0
its just another script in the vehicle seat. the other one doesnt even have a onTouched in it! LemaFoxtrot 14 — 5y
0
its a OnTouched script, meaning its mostly likely to block (mask) other scripts, or run its script 1st. Adenandpuppy 87 — 5y
0
ah. that makes sense LemaFoxtrot 14 — 5y
View all comments (2 more)
0
Use a debounce system as it is probably due to overflowing BenjySmb 16 — 5y
0
yeah that was the problem gg LemaFoxtrot 14 — 5y

Answer this question