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 » Scripting Helpers
Home Search
 

Re: Whats wrong with this teleport

Previous Thread :: Next Thread 
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:14 PM
local spawn = {Vector3.new(game.Workspace.Map.Spawn1.Position),Vector3.new(game.Workspace.Map.Spawn2.Position),Vector3.new(game.Workspace.Map.Spawn3.Position),Vector3.new(game.Workspace.Map.Spawn3.Position)}
function onClick()
script.Parent.Parent.Parent:destroy()
game.Players.LocalPlayer.Character:MoveTo(math.random(#spawn))
end

script.Parent["MouseButton1Click"]:connect(onClick)
Report Abuse
Vescatur is not online. Vescatur
Joined: 18 Feb 2012
Total Posts: 3426
08 Aug 2014 07:16 PM
any output?
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:17 PM
None
Report Abuse
Vescatur is not online. Vescatur
Joined: 18 Feb 2012
Total Posts: 3426
08 Aug 2014 07:18 PM
Just for me, change the script to this, then tell me the output.

local spawn = {Vector3.new(game.Workspace.Map.Spawn1.Position),Vector3.new(game.Workspace.Map.Spawn2.Position),Vector3.new(game.Workspace.Map.Spawn3.Position),Vector3.new(game.Workspace.Map.Spawn3.Position)}
function onClick()
print("1")
script.Parent.Parent.Parent:destroy()
print("2")
game.Players.LocalPlayer.Character:MoveTo(math.random(#spawn))
print("3")
end

script.Parent["MouseButton1Click"]:connect(onClick)

If it prints 3, then it's a bit harder to fix. If it doesn't print 2 or 3, then it's an easy fix.
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:21 PM
I added a wait for child then I got, "19:20:45.694 - Unable to cast double to Vector3"
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:22 PM
and it prints 2
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
08 Aug 2014 07:24 PM
Try using this,
game.Players.LocalPlayer.Character:MoveTo(spawn[math.random(#spawn)])
Report Abuse
Vescatur is not online. Vescatur
Joined: 18 Feb 2012
Total Posts: 3426
08 Aug 2014 07:24 PM
Wouldn't the math.random(#spawn) only give you the number?

So, like wouldn't you need to do something like:

game.Players.LocalPlayer.Character:MoveTo(spawn[math.random(#spawn)])
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:27 PM
It then just moves me like 10 studs over, and thats not where the spawn position is
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
08 Aug 2014 07:29 PM
I made it print where it's teleporting me to, and its just going to 0,0,0
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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