of     1   

Firebeats121
#139906447Thursday, July 10, 2014 8:22 PM GMT

if game.Players:GetPlayers() == 1 then script.Parent.Sound.Play() wait(20) script.Parent.Sound.Stop() end trying to get the game to recognize atleast 1 player and the sound is not playing... Is this right? New to scripting :P :P :P
smiley599
#139906583Thursday, July 10, 2014 8:23 PM GMT

if #game.Players:GetPlayers() == 1 then script.Parent.Sound.Play() wait(20) script.Parent.Sound.Stop() end
smiley599
#139906651Thursday, July 10, 2014 8:24 PM GMT

or if game.Players.NumPlayers>0 --do that
Firebeats121
#139906799Thursday, July 10, 2014 8:25 PM GMT

thank you :)
0_0
#139907139Thursday, July 10, 2014 8:29 PM GMT

Pretty sure it's: if game.Players.NumPlayers == 1 then script.Sound:Play() wait(20) script.Sound:Stop() end Make sure it's called "Sound" and not "sound" and the script and Sound have the same parent.
Firebeats121
#139908045Thursday, July 10, 2014 8:38 PM GMT

making sure.... one second
Firebeats121
#139908623Thursday, July 10, 2014 8:44 PM GMT

None of them are working?
smiley599
#139908868Thursday, July 10, 2014 8:47 PM GMT

if #game.Players:GetPlayers() >0 then script.Parent.Sound:Play() wait(20) script.Parent.Sound:Stop() end
Firebeats121
#139910284Thursday, July 10, 2014 9:01 PM GMT

Alright we are making some progress now... It skips the code and teleports me (I have teleportation later in the code) It only plays sound when I put script.Parent.Sound:Play() by itself....
dansk
#139911064Thursday, July 10, 2014 9:10 PM GMT

local players = game.Players:GetPlayers() or local players = game.Players:GetChildren() -- Gets all players/children if #players==1 then script.Parent.Sound:Play() -- "Sound is the name of your sound" wait(20) script.Parent.Sound:Stop() end if you want a sound each time a player enters you have to use the PlayerEntered event. Look this stuff up on the wiki.
0_0
#139911241Thursday, July 10, 2014 9:12 PM GMT

if game.Players.NumPlayers >= 1 then wait() script.Sound:Play() wait(20) script.Sound:Stop() end That should work, assuming the script and Sound both have the same parent, if I'm missing something here then do: if game.Players.NumPlayers >= 1 then script.Parent.Sound:Play() wait(20) script.Parent.Sound:Stop() end
Bobyman597
#139911689Thursday, July 10, 2014 9:16 PM GMT

No You're doing it all wrong. game.Players.PlayerAdded:connect(function() local num = game.Players:GetPlayers() -- num is an array if num[2] == nil then -- If there is no more than 1 Player in the array script.Parent.Sound.Play() wait(20) script.Parent.Sound.Stop() end end)
Bobyman597
#139911799Thursday, July 10, 2014 9:18 PM GMT

Equally, you MIGHT be able to identify number of Players by #num > 1 but that MAY not work.
0_0
#139911999Thursday, July 10, 2014 9:20 PM GMT

Oh yeah a PlayerAdded event. and lol "That should work, assuming the script and Sound both have the same parent" If you used my script you would have to actually put the Sound inside the script, I'm so tired I've been trying to do something for 4 hours and it's not working and SH isn't helping xD
Firebeats121
#139914755Thursday, July 10, 2014 9:48 PM GMT

sadly none of this is working..... ima check wiki
Firebeats121
#139917213Thursday, July 10, 2014 10:13 PM GMT

So now I know I have to do an event that makes the game count the players.... do I put something like this? game.Players.PlayerAdded:connect(function(player) code texty stuff here.
AnonyAnonymous
#139917734Thursday, July 10, 2014 10:19 PM GMT

Where's the "Sound" located exactly?.
LuaSlayer
#139917828Thursday, July 10, 2014 10:20 PM GMT

I am new to ROBLOX I feel dizzy from all this scripting xD
Firebeats121
#139945683Friday, July 11, 2014 3:01 AM GMT

Sound is located in the workspace and so is the script. I did script.Parent.Sound:Play()
Firebeats121
#139981966Friday, July 11, 2014 1:32 PM GMT

halp.
ash877
#139982437Friday, July 11, 2014 1:42 PM GMT

can you post the entire script?
Firebeats121
#139988586Friday, July 11, 2014 3:27 PM GMT

Whole Script: Spot1= Vector3.new(10,10,10) Spot2= Vector3.new(30,30,30) Spot3= Vector3.new(20,20,20) game.Players.PlayerAdded:connect(function() local num = game.Players:GetPlayers() -- num is an array if num[2] == nil then -- If there is no more than 1 Player in the array script.Parent.Sound.Play() wait(20) script.Parent.Sound.Stop() end end) wait() for i,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == BrickColor.new("Bright red") then v.Character.Torso.CFrame = CFrame.new(Spot1) elseif v.TeamColor == BrickColor.new("White") then v.Character.Torso.CFrame = CFrame.new(Spot2) elseif v.TeamColor == BrickColor.new("Dark Green") then v.Character.Torso.CFrame = CFrame.new(Spot3) end end function GameGuns() wait(3) end wait() function GameEnd() wait(3) end wait()
Firebeats121
#139997519Friday, July 11, 2014 5:13 PM GMT

plz halp?
smiley599
#139997743Friday, July 11, 2014 5:15 PM GMT

It's :Play not .Play i think
Firebeats121
#139998714Friday, July 11, 2014 5:26 PM GMT

Yay its solved! I was stoopid! Thanks all for who helped me!

    of     1