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
11 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):

01function checkHit(part)
02print("TOUCHED PART HAS BEEN HIT")
03if part.Parent.Parent.Name == "ModBlueCar" or "ModGreenJeep" or "ModPoliceCar" or "ModRedTruck" or "ModSchoolBus" or "ModSportsCar" then
04if part.Parent.Parent.Name ~= script.Parent.Name then
05print("Game over, players car hit something.")
06car = script.Parent
07hit = car.Hit
08hit.Value = true
09end
10end
11end
12 
13 
14script.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 11 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