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

In a Call Of Duty Game i Am Making How Would i Add a Sound When touched?

Asked by 7 years ago

All i want is when the player touches the nuke you hear the sound kaboom sound id(131961140)

active = false
function touch(hit)
if (active == true) then return end
active = true
c = game.Workspace:GetChildren()
for i =1,#c do
p = c[i]:GetChildren()
for l =1,#p do
if (p[l].className == "Humanoid" and p[l].Name == "Humanoid") then
if ((p[l].Parent.Torso.Position - script.Parent.Position).magnitude < 4) then
g = game.Workspace:GetChildren()
for h = 1,#g do
j = g[h]:GetChildren()
for k = 1,#j do
if (j[k].className == "Humanoid" and j[k].Name == "Zombie" and j[k].Health > 0) then
game.Workspace.ZombieAmmount.Value = game.Workspace.ZombieAmmount.Value -1
j[k].Parent:Remove()

end end end

z = game.Players:GetChildren()
for x =1,#z do
if (z[x] ~= nil and z[x]:FindFirstChild("PlayerGui") ~= nil) then
gui = game.Lighting.NukeGui:clone()
gui.Script.Disabled = false
gui.Parent = z[x].PlayerGui
game:GetService("Debris"):AddItem(gui, 10)
end end

game:GetService("Debris"):AddItem(script.Parent.Parent, 0.1)
wait(1)
end
end
end
end
active = false
end

script.Parent.Touched:connect(touch)



0
accept my answer hiimgoodpack 2009 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You can insert a sound inside teh script, then do the following.

script,.Sound:Play()
0
Yes Ik I Solved it TheDarkNinjaBro -21 — 7y
0
accept my answer then hiimgoodpack 2009 — 7y
Ad

Answer this question