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

My goal sound script won't work. Why?

Asked by 11 years ago
01Goal = game.Workspace.Goal
02Ball = game.Workspace.Ball
03Message = game.Workspace.Message
04Text = Message.Text
05GoalSound = game.Workspace.GoalSound
06SoundID = GoalSound.SoundId
07BoooSound = game.Workspace.BoooSound
08SoundID = BoooSound,SoundId
09 
10function BallToGoal()
11function onTouched(Goal)
12end
13end
14 
15Ball:onTouched(Goal) -- Defining line 8
View all 33 lines...

This script is for a soccer game. So the script is like, when the ball touches the goal.. There is a message that says "GOAL!!!" and has a sound to it. If it doesn't, It says "Whoa, that sucked!" thats if Ball:onTouched(Goal) would equal to false. Any help?

3 answers

Log in to vote
0
Answered by
Asirix 15
11 years ago

You're basically looping. DO this.

1GoalSound.SoundID:Play()
2Wait(5) -- or however long you want it to play.
3GoalSound.SoundID:Stop()

Also use elseif not else and if.

0
Ok, thank you Roboy5857 20 — 11y
Ad
Log in to vote
0
Answered by
bobder2 135
11 years ago
1GoalSound = game.Workspace.GoalSound
2SoundID = GoalSound.SoundId
3BoooSound = game.Workspace.BoooSound
4SoundID = BoooSound,SoundId

You have two variables named SoundID. You also put a comma instead of a period for the BoooSoundID

1GoalSound = game.Workspace.GoalSound
2GoalSoundID = GoalSound.SoundId
3BoooSound = game.Workspace.BoooSound
4BoooSoundID = BoooSound.SoundId

That's what it should look like

Log in to vote
0
Answered by 11 years ago

for soundID dont put the link, put the name of the sound in your workspace.

Answer this question