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 » Game Design
Home Search
 

Re: Can't seem to teleport a player to a location using CFrame

Previous Thread :: Next Thread 
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 06:15 AM
I just can't even script in the mornings, lol. Here's my code; I know that its wrong just cant figure out what..

--Reyscent

player = script.Parent.Parent.Parent.Parent.Parent

function Give()
local Sword = script.Parent.LinkedSword
Sword:Clone()
Sword.Parent = player.Backpack

end

function Remove()
local All = script.Parent.Parent.Parent
All:Destroy()
end

function Teleport()
player.Torso.CFrame = CFrame.new(39.536, 0.57, -70.964)
end

script.Parent.MouseButton1Down:connect(Teleport)
script.Parent.MouseButton1Down:connect(Remove)
script.Parent.MouseButton1Down:connect(Give)


:nbc me, omg
Report Abuse
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 06:22 AM
b1


:nbc me, omg
Report Abuse
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 06:24 AM
b2


:nbc me, omg
Report Abuse
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 06:28 AM
b3


:nbc me, omg
Report Abuse
alphaboy299 is not online. alphaboy299
Joined: 15 Jun 2013
Total Posts: 1496
26 Dec 2015 07:05 AM
Which part of it exactly is not working?What's the output?

Also if you teleport the torso like that the player will die since you're only teleporting the torso and the rest of the body is left back,killing the player.
Report Abuse
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 07:07 AM
My parents are screwed and it doesnt select the player, I don't think. How do I make it so I don't kill him then?


:nbc me, omg
Report Abuse
alphaboy299 is not online. alphaboy299
Joined: 15 Jun 2013
Total Posts: 1496
26 Dec 2015 07:11 AM
Well the simple fix is make this a localscript,put this in starterplayerscripts and instead of doing player=script.Parent... do player = game.Players.LocalPlayer

For teleporting the player mode the entire model with MoveTo()(http://wiki.roblox.com/index.php?title=API:Class/Model/MoveTo)
or use SetPrimaryPartCFrame
(http://wiki.roblox.com/index.php?title=API:Class/Model/SetPrimaryPartCFrame)
after setting the torso as the primary part.
Report Abuse
Reyscent is not online. Reyscent
Joined: 01 Jun 2014
Total Posts: 184
26 Dec 2015 07:21 AM
Thanks!


:nbc me, omg
Report Abuse
GavAttack12 is not online. GavAttack12
Joined: 04 Aug 2013
Total Posts: 249
26 Dec 2015 08:47 AM
i use this, and i just made a game using a script similar to that, heres the line:

Places = {Vector3.new(26, 140.41, -159.5), Vector3.new(-172, 140.5, -159.5)}
local Player = script.Parent.Parent.Parent.Parent.Parent
function Click()
wait(4.1)
Player.Character:MoveTo(Places[math.random(1,#Places)])
end

script.Parent.MouseButton1Down:connect(Click)


--//GavAttack12
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
26 Dec 2015 08:59 AM
local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
if Player.Character then
local Sword = script.Parent.LinkedSword
Sword.Parent = player.Backpack
player.Character:MoveTo(Vector3.new(39.536, 0.57, -70.964))
script.Parent.Parent.Parent:Destroy()
end
end)
Report Abuse
alphaboy299 is not online. alphaboy299
Joined: 15 Jun 2013
Total Posts: 1496
26 Dec 2015 09:03 AM
The thing I don't understand about forums is that even once the answer is given other people tend to post the variations of the same answer.Not pointing any fingers just pointing this one out.

Now let's all forget I said this and just go to the next thread.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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