Hello, I’m trying to throw a tool. I copied code from another question. And surprisingly it kinda works, but I’m getting an error.
LinearVelocity is not a valid member of MeshPart
I have LinearVelocity under Handle. So I’m not sure why this is happening.
Code
local tool = script.Parent
local UIS = game:GetService("UserInputService")
local Power = 50 -- Or however far you want it to go
local Character
local Equipped = false
tool.Equipped:Connect(function()
Character = tool.Parent
Equipped = true
end)
tool.Unequipped:Connect(function()
Equipped = false
end)
UIS.InputBegan:Connect(function(key, gp)
if gp then return end
if key.KeyCode == Enum.KeyCode.E and Equipped == true then
tool.Parent = workspace
tool.Handle.Position = Character.PrimaryPart.Position + Character.PrimaryPart.CFrame.LookVector * 3
tool.Handle.LinearVelocity = Character.PrimaryPart.CFrame.LookVector * Power
end
end)