nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
|
| 31 Jul 2015 11:25 AM |
while true do wait(5) players = game.Players.NumPlayers games = game.ServerStorage.Games:GetChildren() local player = game.Players.LocalPlayer val = game.Workspace.Topval local playen = game.Players.LocalPlayer.Name local Playerw = game.Workspace:FindFirstChild(playen)
if players >= 1 then wait(1) rangame = math.random(1, #games) minigamech = games[rangame] minigamec = minigamech:Clone() minigamec.Parent = game.Workspace spawns = minigamec.Spawns:GetChildren() for i, v in pairs(game.Players:GetChildren()) do Pame = v.Name checkName = game.Workspace:FindFirstChild(Pame) if checkName then checkHumanoid = checkName:FindFirstChild("Humanoid") if checkHumanoid then checkName:MoveTo(spawns[i].Position) end end end wait(2.2) pie = game.Lighting.Winner:clone() pie.Parent = Playerw
for i = 9, 6, -1 do game.Workspace.Topval.Value = "Time Left "..i wait(1) end if Playerw.Winner then done = math.random(10,50) player.stats.cash.Value=player.stats.cash.Value+(done) for i = 5, 1, -1 do game.Workspace.Topval.Value = "Time Left "..i wait(1) end else
end wait(7) minigamec:remove() end
end
it comes up with ServerScriptService.Script:11: attempt to index field 'LocalPlayer' (a nil value) and i tried putting it in a local script and that just broke the script, it only works on solo mode |
|
|
| Report Abuse |
|
|
nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
| |
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 01 Aug 2015 03:49 AM |
you can't get a "local player" in a server script. read up more on the difference between local and server scripts.
http://wiki.roblox.com/index.php?title=API:Class/LocalScript http://wiki.roblox.com/index.php?title=API:Class/Script |
|
|
| Report Abuse |
|
|
nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
|
| 01 Aug 2015 03:57 AM |
| @instawin i know i cant use localplayer i was wondering how could i still get localplayer in a global script |
|
|
| Report Abuse |
|
|
nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
|
| 01 Aug 2015 07:33 AM |
| Bump, Someone help this isnt to advanced, is it? |
|
|
| Report Abuse |
|
|
Clxver
|
  |
| Joined: 19 Oct 2014 |
| Total Posts: 727 |
|
|
| 01 Aug 2015 08:21 AM |
for _,v in pairs(game.Players:GetChildren()) do --code end
If not you, then who? If not now, then when? |
|
|
| Report Abuse |
|
|
nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
|
| 01 Aug 2015 08:24 AM |
| @Clxver would i just remove the player variable and put the code inside of the function |
|
|
| Report Abuse |
|
|
nicebros
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 102 |
|
| |
|