Hello,
I want to apply a force to a part once it get touched by a player tool, so here's my script:
local function onTouch (part)
print (part.Parent)
local player = part.Parent.Parent
print (player.Name)
if player then
local humanoid = player:FindFirstChild("Humanoid")
if humanoid then
local direction = humanoid.MoveDirection
print ('X: ' .. tostring(direction.X))
print ('Z: ' .. tostring(direction.Z))
print ('Magnitude: ' .. tostring(direction.Magnitude))
end
end
end
There's no error with the script, moveDirection is always returning 0,0 for X and Z doesn't matter from where I touch this part.
I expected X and Z to have values which would help me to define the force direction.
What am I doing wrong? Thanks

1 comment
Could you show a video of how you're moving when you use the tool?