|
| 16 Jan 2016 05:55 PM |
Can someone modify my script, to make play music in intermission and round? Here: local replicatedstorage = game:GetService('ReplicatedStorage') local status = replicatedstorage:WaitForChild('InfoValue') local mapstorage = game.Workspace:WaitForChild('mapStorage') while true do --[[ while game.Players.NumPlayers > 2 do status.Value = 'There must be atleast 2 Players or more to play!' repeat wait() until game.Players.NumPlayers >= 2 end ]]
for i = 15,0,-1 do status.Value = 'Intermission: '..i wait(1) end
local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren() local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)] chosenmap:Clone().Parent = mapstorage status.Value = 'The game is starting in a moment!' wait(3) local spawns = chosenmap:WaitForChild('Spawners'):GetChildren() for _, player in pairs (game.Players:GetPlayers()) do if player and #spawns > 0 then local torso = player.Character:WaitForChild('Torso') local allspawns = math.random(1, #spawns) local randomspawn = spawns[allspawns] if randomspawn and torso then table.remove(spawns, allspawns) torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0)) local sword = game.ReplicatedStorage.ClassicSword local newsword = sword:Clone() newsword.Parent = player.Backpack end end end
for i= 90,0,-1 do status.Value = 'Seconds left: '..i if i == 0 then status.Value = 'Game Over!' for _, player in pairs (game.Players:GetPlayers()) do if player:FindFirstChild('leaderstats') then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 2 end end break else end wait(1) end
mapstorage:ClearAllChildren() end
I'm just a innocent guy, that destroys others life... |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 06:25 PM |
Right click on your script and paste a 'Sound' object into it and put in the proper ID
Once you do that insert this line of code to wherever you want it to play: script.soundName:Play()
and this whenever you want it to stop script.soundName:Play()
|
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 06:26 PM |
and this whenever you want it to stop script.soundName:Stop()*
Sorry my copy+paste game is weak
|
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 16 Jan 2016 06:36 PM |
" local status = replicatedstorage:WaitForChild('InfoValue') local mapstorage = game.Workspace:WaitForChild('mapStorage') " This is wrong. You are waiting for a child to be added whose name is 'InfoValue', which is fine. But that DOES yield. The second waits for a child 'mapStorage' to be added, which has more than likely already been added. You need to add an if statement to see if it is already there.
" local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)] chosenmap:Clone().Parent = mapstorage status.Value = 'The game is starting in a moment!' wait(3) local spawns = chosenmap:WaitForChild('Spawners'):GetChildren() for _, player in pairs (game.Players:GetPlayers()) do if player and #spawns > 0 then local torso = player.Character:WaitForChild('Torso')
"
This section is all kinds of wrong.
First line is fine. Second line clones the chosen map and places it in mapstorage. The clone is in workspace while you are changing the one in ServerStorage.
Omg, the 4th and 5th line. Like wow. "wait(3)" then wait for the spawners. Same as mentioned before. The for loop needs to use ipairs because pairs is redundant. The method 'GetPlayers' returns an array, not a table.
After the for loop, the if statement needs to find out if their character is there. "player.Character:WaitForChild(" You can probably get away with using the 'FindFirstChild' method, but definatly not the 'WaitForChild' method in this situation.
Visit my thread: http://forum.roblox.com/Forum/ShowPost.aspx?PostID=181749340
|
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 06:38 PM |
"My script" probably a free model, earlier today I gave you the simplest script and you couldnt even understand it. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 07:47 PM |
It's not freemodels. cx
I'm just a innocent guy, that destroys others life... |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 07:49 PM |
dude. are you helping or talking about my script? it works fine. I just need music to play in intermission and round.
I'm just a innocent guy, that destroys others life... |
|
|
| Report Abuse |
|
|