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

Ball OnTouched help?

Asked by 9 years ago

Basically, whenever I put this script that I made into the nets it does not do what it is supposed to do, can you guys help? Basically, I want it to shout a message saying goal and enable it to where all the boolvalues in the goals would be true when a goal has happened, but it isn't showing anything in the error output and I have almost everything to see what is going on. If you could help me, that would be great.

v What I am putting the script into. Link1 v is the ball going into the goal. Link2

01hit1 = script.Parent.Parent.GoalNet1.Hit
02hit2 = script.Parent.Parent.GoalNet2.Hit
03hit3 = script.Parent.Parent.GoalNet3.Hit
04hit4 = script.Parent.Parent.GoalNet4.Hit
05 
06 
07 
08function onTouched(hit)
09if hit.Name == "Ball" and hit1 == false and hit2 == false and hit3 == false and hit4 == false  then
10hit1 = true
11hit2 = true
12hit3 = true
13hit4 = true
14local m = Instance.new("Message")
15m.Parent = game.Workspace
View all 25 lines...

1 answer

Log in to vote
0
Answered by 9 years ago

If the name of the values inside the Goalnets are "Hit", then try this:

01hit1 = script.Parent.Parent.GoalNet1.Hit
02hit2 = script.Parent.Parent.GoalNet2.Hit
03hit3 = script.Parent.Parent.GoalNet3.Hit
04hit4 = script.Parent.Parent.GoalNet4.Hit
05 
06 
07 
08function onTouched(hit)
09if hit.Name == "Ball" and hit1.Value == false and hit2.Value == false and hit3.Value == false and hit4.Value == false  then
10hit1 = true
11hit2 = true
12hit3 = true
13hit4 = true
14local m = Instance.new("Message")
15m.Parent = game.Workspace
View all 25 lines...

What I see is wrong is that you forgot to do ".Value" after hit1, hit2, etc. Hope this works!

Ad

Answer this question