I’ve been trying to measure a Sword’s velocity, but when I try this script it’ll only print out the Player’s velocity rather than the Sword’s itself.
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local Sword = Character:WaitForChild("ClassicSword")
local SwordHandle = Sword.Handle
while wait() do
print(SwordHandle.Velocity)
end
How can I go around this and measure just the Sword’s Velocity?
You can get the swords velocity by subtracting that of the player’s, because the velocity you are getting would be both of theirs’s combined.
1 Like
I tried this but it still remained at 0
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Sword = Character:WaitForChild("ClassicSword")
local SwordHandle = Sword.Handle
while wait() do
local Velocity = (SwordHandle.Velocity.Magnitude - HumanoidRootPart.Velocity.Magnitude)
print(Velocity)
end
What should I use instead of Velocity?
1 Like
https://developer.roblox.com/en-us/api-reference/function/BasePart/GetVelocityAtPosition
The required Vector3 could just be the center of the sword’s handle (the handles position property).
I don’t believe this is the non-deprecated feature either. I’m pretty sure it’s BasePart.AssemblyLinearVelocity (correct me if I’m wrong)
I’ve tried both already and it’s still getting the same result.
1 Like