kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 03:19 PM |
i need help with this script
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue")
while true do --Intermission for i = 30,0,-1 do status.Value = "Intermission: "..i wait(1) end status.Value = "Game has started" local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren() local chosemap = mapsinserverstorage[math.random(1, mapsinserverstorage)] chosemap:Clone().Parent = game.Workspace status.Value = 'Run from potatoe man!' wait(2) local spawns = chosemap:WaitForChild('Spawns') :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 randomspawns = Spawns[allspawns] if randomspawns and torso then table.remove(Spawns,allspawns) torso.CFrame = CFrame.new(randomspawns.Position + Vector3.new(0,2,0)) end end end while true do wait(10) local players = game.Players:GetChildren() print(#players) if #players >= 1 then local murderer = players[math.random(1,#players)] local Potatoe = game.Lighting.Potatoe:Clone() Potatoe.Parent = murderer.Backpack end end wait(120) game.Workspace.YoloHouse:Destroy() wait(9) status.Value = "finished!" end --WHY DOESNT THIS WORK |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 20 Dec 2016 03:20 PM |
Probably because you have 2 "while true do"
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 03:21 PM |
"WHY DOESN'T THIS WORK" is not enough here. We need information.
What happens? What is SUPPOSED to happen? What does the output say?
Can't show a horse the water to drink if he is blind folded. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 03:21 PM |
| Always tell us any errors the script is sending into output. |
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 03:48 PM |
| the script is suppost to get the map out of server storage teleport all players to the spawsn and then get a random player a potatoe then after 120 sec it will destry the map |
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 03:49 PM |
Output 16:15:36.366 - ServerScriptService.MainScript:12: bad argument #2 to 'random' (number expected, got table) |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 20 Dec 2016 03:54 PM |
its suppose to be math.random(1, #mapsinserverstorage) you forgot the tag
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 03:54 PM |
Here is the simple finish for others: #code local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") while true do --Intermission for i = 30,0,-1 do status.Value = "Intermission: "..i wait(1) end status.Value = "Game has started" local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren() local chosemap = mapsinserverstorage[math.random(1, mapsinserverstorage)] chosemap:Clone().Parent = game.Workspace status.Value = 'Run from potatoe man!' wait(2) local spawns = chosemap:WaitForChild('Spawns') :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 randomspawns = Spawns[allspawns] if randomspawns and torso then table.remove(Spawns,allspawns) torso.CFrame = CFrame.new(randomspawns.Position + Vector3.new(0,2,0)) end end end while true do wait(10) local players = game.Players:GetChildren() print(#players) if #players >= 1 then local murderer = players[math.random(1,#players)] local Potatoe = game.Lighting.Potatoe:Clone() Potatoe.Parent = murderer.Backpack end end wait(120) game.Workspace.YoloHouse:Destroy() wait(9) status.Value = "finished!" end --WHY DOESNT THIS WORK
https://www.roblox.com/games/462902053/Project-Maze-Prototype https://forum.roblox.com/Forum/ShowPost.aspx?PostID=204784127 |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 03:55 PM |
So to begin: #code math.random(1, mapsinserverstorage) will dont work
This, however, will: #code math.random(1, mapsinserverstorage:GetChildren())
https://www.roblox.com/games/462902053/Project-Maze-Prototype https://forum.roblox.com/Forum/ShowPost.aspx?PostID=204784127 |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 20 Dec 2016 03:56 PM |
no its math.random(1, #mapsinserverstorage) because mapsinserverstorage is table so you cant :GetChildren() with it
|
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
| |
|
|
| 20 Dec 2016 04:00 PM |
Please don't just spam us with "it doesn't WORK!!!!", actually give us errors from the console, or else we can't help you.
https://www.roblox.com/games/462902053/Project-Maze-Prototype https://forum.roblox.com/Forum/ShowPost.aspx?PostID=204784127 |
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 04:02 PM |
it sais spawns is unknown also it sais ServerScriptService.MainScript:4: attempt to index global 'status' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 04:04 PM |
Maybe moving the value from replicated storage into the script might be a better option.
https://www.roblox.com/games/462902053/Project-Maze-Prototype https://forum.roblox.com/Forum/ShowPost.aspx?PostID=204784127 |
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 04:28 PM |
Ive been tring to script but almost none of them Works
sigh guess ill play minecraft now |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 20 Dec 2016 04:41 PM |
local status game:GetService("ReplicatedStorage"):WaitForChild("StatusValue") print('StatusFound starting script...')
while true do for i = 30,0,-1 do status.Value = "Intermission: "..i wait(1) end status.Value = "Game has started" print('Game starting') local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren() local chosemap = mapsinserverstorage[math.random(1, #mapsinserverstorage)] print('MapChosen is: ' .. chosemap.Name) chosemap:Clone().Parent = game.Workspace status.Value = 'Run from potatoe man!' wait(2)
for _, player in pairs(game.Players:GetPlayers()) do if player and #spawns > 0 then local spawns = chosemap:WaitForChild('Spawns'):GetChildren() local torso = player.Character:WaitForChild('Torso') local randomspawns = spawns[math.random(1, #spawns)] print(randomspawns.Name .. ' is spawn chosen for ' .. player.Name) for i,UsableSpawn in pairs(spawns) do if UsableSpawn.Name == randomspawns.Name then print('Removed: ' .. UsableSpawn.Name) UsableSpawn:Destroy() --Destroys since used end end torso.CFrame = CFrame.new(randomspawns.Position + Vector3.new(0,2,0)) end end print('Stopped editing right here')
--I didn't edit past here because idek what this is-- while true do wait(10) local players = game.Players:GetChildren() print(#players) if #players >= 1 then local murderer = players[math.random(1,#players)] local Potatoe = game.Lighting.Potatoe:Clone() Potatoe.Parent = murderer.Backpack end end wait(120) game.Workspace.YoloHouse:Destroy() wait(9) status.Value = "finished!" end
tell me all prints in output
|
|
|
| Report Abuse |
|
|
kedny23
|
  |
| Joined: 11 Jul 2015 |
| Total Posts: 182 |
|
|
| 20 Dec 2016 08:52 PM |
| soso all i need help with is just getting players to teleprt to spawns |
|
|
| Report Abuse |
|
|