0

# How to move the position of your character?

Hello everyone, good morning (or afternoon if your in a different time zone) and today I have a serious question that came up in my head.

Literally, how do you move the position of your character on the X,Y, and Z axis similar to how you would do it for a brick?

Lately I have been going into the keyDown stuff, and even though im a complete novice towards scripting and probably shouldn't be doing this kind of advanced stuff, I like to experiment.

My ultimate goal is to make a script that once your press a certain key on the keyboard, it sends your character moving in different positions, as you are about to see in the code I will show you.

player = game.Players.LocalPlayer

tool = script.Parent

tool.Equipped:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "h" then
print("You pressed h")
else
print("Try again and press h")
end
end)
end)


That was my first attempt at doing anything with keyDown, and it is pretty basic.

0

You Cframe the character to a new area.

0
Use something like this Champion121212 22 — 7y
0
torso.CFrame = CFrame.new(-432, 2.2, 64) Champion121212 22 — 7y
0
So how would I be able to get the current position of the character, and add that one on? So that way it won't simply go to the position I put, and add on from the one the character is already at? wolfgangm17 0 — 7y
0
That question is for someone more advanced than me... Sorry. Champion121212 22 — 7y
0
Since it's a tool, and I want for it to be local would it be someting like game.Workspace.Players.LocalPlayer.torso.CFrame = CFrame.new(-432, 2.2, 64)? Because I am basically confused on moving the character itself. wolfgangm17 0 — 7y
0
Sorry, the question is beyond my knowledge... I wish I could help beyond what I said. Champion121212 22 — 7y
0
player = game.Players.LocalPlayer
local mouse = player:GetMouse()
tool = script.Parent
tool.Equipped:connect(function()
mouse.KeyDown:connect(function(key)
if key == "h" then
player.Character:MoveTo(mouse.Hit)
print("You pressed h")
else
print("Try again and press h")
end
end)
end)


I believe that's how it goes... Maybe not... Hope this helped, I'm sort of new to key's as well however I'm familiar with the moving of a character.

0
Doesn't seem to work since the output is telling me Position is not a valid member, also it looks like what you gave me moves the character when I press "h" wherever my mouse is? wolfgangm17 0 — 7y
0
Yes, change on line 07 "mouse.Hit.Position" to "mouse.Hit.CFrame" I know it's CFrame or Position... Something... e.e micke3212 35 — 7y
0
CFrame is not a valid member either xD wolfgangm17 0 — 7y
0
Wow... I feel dumb, um... Try just Hit... e.e Maybe that works? micke3212 35 — 7y