generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Game end script not working

Previous Thread :: Next Thread 
GRAGGER2001 is not online. GRAGGER2001
Joined: 05 Apr 2009
Total Posts: 2043
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
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
27 Dec 2015 11:02 AM
Try spawns[math.random(1, #spawns)]


The Legend of Heroes
Report Abuse
GRAGGER2001 is not online. GRAGGER2001
Joined: 05 Apr 2009
Total Posts: 2043
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
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
27 Dec 2015 11:21 AM
yeah


The Legend of Heroes
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
27 Dec 2015 11:21 AM
Actually no since CFrame change .Position to .CFrame


The Legend of Heroes
Report Abuse
GRAGGER2001 is not online. GRAGGER2001
Joined: 05 Apr 2009
Total Posts: 2043
27 Dec 2015 11:33 AM
Thank you.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image