You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Make a gui that teleports players.
-
What is the issue? It teleports the camera but not character and when you walk it all becomes wierd. https://youtu.be/fnu1t-HWv4Y
-
What solutions have you tried so far? Changing a few things in the localscript but it resulted in errors and the same issues.
Local Script
local twrpath = game.Workspace.TowerSpawns.Tower1.Position
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.Character.HumanoidRootPart.Position = twrpath
end)
2 Likes
xZylter
(xZylter)
#2
You shouldn’t use a local script for this if you are trying to teleport the player.
1 Like
Do you mean to use, :SetPrimaryPartCFrame()
? Because it moves the whole model from the primarypart:
local twrpath = game.Workspace.TowerSpawns.Tower1.CFrame
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(twrpath)
end)
@xZylter
If I’m not mistaken local scripts can work because clients have network ownership of their character.
xZylter
(xZylter)
#4
Never tried it so maybe it does.
Not sure about what to use i just need to teleport a player using a gui.
xZylter
(xZylter)
#6
Try using :MoveTo(Vector3)
on the character model
Alright let me try it. Hope it works.
Is this correct game.Players.LocalPlayer.Character:MoveTo(100,100,100)? sorry im new.
Unable to cast double to Vector3
xZylter
(xZylter)
#10
You must use Vector3.new() to construct a new Vector3
Use CFrame, this gives you the exact position and rotation of the part
local twrpath = game.Workspace.TowerSpawns.Tower1.CFrame
Next, use the :SetPrimaryPartCFrame() function of your rig, this will set the CFrame of your rig while maintaining the joint positions
script.Parent.MouseButton1Click:Connect(function()
game:GetService("Players").LocalPlayer.Character:SetPrimaryPartCFrame(twrpath)
end
1 Like
I think so but it will be like this or the one that Filtered provide you.
The MoveTo(Vector3) from xZylter worked thanks!
move:to doesnt teleport them, it just moves the character over to a position, and not actually teleporting them.
xZylter
(xZylter)
#15
Model:MoveTo() does do that. You’re thinking of Humnaoid:MoveTo().
1 Like
oh them nvm, i didnt really understand what you were saying but yeah the model does that.