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

.Touched not working with local parts etc..

Asked by
TomsGames 225 Moderation Voter
10 years ago

I've posted this on the scripting helpers forums, I'll post the whole post here as requested last time.

Right...

I just reworked the movement system of my game. It took me 2 days. I don't want to find out now that it STILL does not work! >.<

This is the game:

http://www.roblox.com/Traffic-Racer-V2-place?id=134174853

The issue is when a car hits another car, nothing happens!

I currently have this in a non-disabled local script inside a 'hit sensor' brick (which is the grey outline of the brick):

function checkHit(part)
print("TOUCHED PART HAS BEEN HIT")
if part.Parent.Parent.Name == "ModBlueCar" or "ModGreenJeep" or "ModPoliceCar" or "ModRedTruck" or "ModSchoolBus" or "ModSportsCar" then
if part.Parent.Parent.Name ~= script.Parent.Name then
print("Game over, players car hit something.")
car = script.Parent
hit = car.Hit
hit.Value = true
end
end
end


script.Parent.Touched:connect(checkHit)

Nothing prints and I'm getting scared ._.

I know I've not done the right parenting etc... I just want it to trigger the print function. Please can someone help >.<

1 answer

Log in to vote
1
Answered by 10 years ago

If you say local parts I'm supposing you mean a part that is inside the camera. Scripts, local or not, do not function in the camera. Instead I suggest having the script operate inside the playergui.

Ad

Answer this question