Code
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
Player:FindFirstChild("Torso").Position = -34.37, 0.5, 8.54
end)
Code
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
Player:FindFirstChild("Torso").Position = -34.37, 0.5, 8.54
end)
When setting a position in the game, positions are defined as Vector3s. To set a new position or size or similar property, you need to explicitly state that you're generating a new Vector3 from a set of coordinates. You need to also move the Character of the Player, not the Player itself. Also, moving the player's torso only would get the player killed, as it only moves the singular part. If you want to move the entire model, I would suggest using CFrames, as it is made simple with the function :SetPrimaryPartCFrame. A CFrame can be made using a Vector3, so it's just one little extra step.
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
Player.Character:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-34.37, 0.5, 8.54)))
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
The torso is located in the players character, not in the player!
So i would have to re-write the script on line 5 to... I'm confused on how to add a players character.
NVM
Player.Character:MoveTo(-34.37, 0.5, 8.54) --You also may want to check if the character has loaded, and that the humanoid`s health is not 0