|
| 27 Dec 2015 10:57 AM |
It won't teleport them to a random spawn like I want it to... Errors at line 9.
local endtime = math.random(10) local fish = game.ServerStorage.Player.Weight local winner = game.ServerStorage.Player local spawns = game.Workspace.Spawns:GetChildren() function gameend() for i,v in pairs(game.Players:GetChildren())do if v:FindFirstChild("leaderstats") then if game.Workspace:FindFirstChild(v.Name)then game.Workspace:FindFirstChild(v.Name).Torso.CFrame = CFrame.new(math.random(1,#spawns).Position) end if v.leaderstats["Total Weight"].Value > fish.Value then fish.Value = v.leaderstats["Total Weight"].Value winner.Value = v.Name wait(0.25) end wait(0.5) for i,a in pairs(v.leaderstats:GetChildren())do if a.Name ~= "Money" then a.Value = 0 end end end end wait(5) local m = Instance.new("Message",game.Workspace) m.Text = winner.Value.." has won the match! Time to try again! Good luck!" wait(3) m:remove() winner.Value = "" end while true do wait(endtime) gameend() end |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2015 11:02 AM |
Try spawns[math.random(1, #spawns)]
The Legend of Heroes |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2015 11:13 AM |
So like this:
game.Workspace:FindFirstChild(v.Name).Torso.CFrame = CFrame.new(spawns[math.random(1, #spawns)].Position) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2015 11:21 AM |
Actually no since CFrame change .Position to .CFrame
The Legend of Heroes |
|
|
| Report Abuse |
|
|
| |
|