ldaspp
(ldaspp)
July 13, 2024, 12:45pm
#1
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to tell if the mobile joystick is facing forwards for a run system
What is the issue? Include screenshots / videos if possible!
No idea how I can do this
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
No one has ahd the same problem
4 Likes
Could you try Humanoid.MoveDirection
?. This option isn’t only for mobile but it could work.
4 Likes
ldaspp
(ldaspp)
July 13, 2024, 12:58pm
#3
How would I utilize this too see if the player moves forwards?
2 Likes
if Humanoid.MoveDirection == Character.HumanoidRootPart.CFrame.LookVector then
--line of code
end
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:07pm
#6
This doesn’t work whatsoever, I need something better
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:08pm
#7
How exactly should I use this?, explain please
1 Like
Humanoid.MoveDirection
is a Vector3
and detects the direction the player is moving in. If it isn’t moving, it will be set to 0, 0, 0
.
1 Like
I will try and find how to do this. I’m currently testing this on a roblox game.
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:11pm
#11
thank you very much for your helpfulness
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:13pm
#13
What in the world is robloxcharlimits???
1 Like
Oh no don’t worry. I used that cuz roblox’s character limits are 30. So my sentence was too short by itself.
1 Like
local roundhumanoidmd = Vector3.new(math.round(humanoid.MoveDirection.X), math.round(humanoid.MoveDirection.Y), math.round(humanoid.MoveDirection.Z))
local roundlookvector = Vector3.new(math.round(char.HumanoidRootPart.CFrame.LookVector.X), math.round(char.HumanoidRootPart.CFrame.LookVector.Y), math.round(char.HumanoidRootPart.CFrame.LookVector.Z))
if roundhumanoidmd == roundlookvector then
--code
end
I rounded both Vector3
s and checked if there are equal, meaning that the character is walking forwards.
Remember to define char
.
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:28pm
#16
shell:
local roundhumanoidmd = Vector3.new(math.round(humanoid.MoveDirection.X), math.round(humanoid.MoveDirection.Y), math.round(humanoid.MoveDirection.Z))
local roundlookvector = Vector3.new(math.round(char.HumanoidRootPart.CFrame.LookVector.X), math.round(char.HumanoidRootPart.CFrame.LookVector.Y), math.round(char.HumanoidRootPart.CFrame.LookVector.Z))
if roundhumanoidmd == roundlookvector then
--code
end
thank you, it works very well.
1 Like
You might want to loop it or do :GetPropertyChangedSignal()
to both Humanoid
and HumanoidRootPart
as the position will keep on changing.
1 Like
ldaspp
(ldaspp)
July 13, 2024, 1:33pm
#20
I just needed to find out wether they were moving forwards once. after that it doesn’t matter. I just check everytime they want to sprint.
1 Like
oh ok. Don’t worry about it then.
1 Like