--Handles serversided picking up
game.ReplicatedStorage.Events.PickUp.OnServerEvent:Connect(function(Player, Part)
local Character = Player.Character or Player.CharacterAdded:wait()
Part:SetNetworkOwner(Player)
Part.Parent = Character
Part.Name = "HeldItem"
local w = Instance.new("ManualWeld")
w.Parent = Part
w.Part0 = Part
w.Part1 = Character.HumanoidRootPart
w.C0 = CFrame.new(0,-(Character:FindFirstChild("HumanoidRootPart").Size.Y + (Part.Size.Y)),0)*CFrame.fromEulerAnglesXYZ(0, 0, 0)
Part.CanCollide = false
end)
--Handles serversided throwing
game.ReplicatedStorage.Events.Throw.OnServerEvent:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:wait()
local ScriptInsideHeldItem = Character:FindFirstChild("HeldItem"):FindFirstChild("Script")
local Velocity = Instance.new("BodyVelocity")
Character:FindFirstChild("HeldItem"):FindFirstChild("ManualWeld"):Destroy()
Velocity.Parent = Character:FindFirstChild("HeldItem")
Velocity.Velocity = (Character.HumanoidRootPart.CFrame.lookVector * 5) * 6 + Vector3.new(0,40,0)
wait(.1)
Velocity:Destroy()
wait(.2)
Character:FindFirstChild("HeldItem").CanCollide = true
if ScriptInsideHeldItem then
Character:FindFirstChild("HeldItem").Script.Disabled = false
end
wait(.5)
Character:FindFirstChild("HeldItem"):SetNetworkOwnershipAuto()
Character:FindFirstChild("HeldItem").Parent = game.Workspace
end)
Sorry for not indenting, I don’t indent my code
Anyway, this code here basically welds a part to the player, and when clicked it unwelds and applies velocity to that part to “throw” it.
Everytime I pick up a part with 0.01 density, the bodythrust in my other code for a long jump works just fine. But as soon as a throw it, it’s like the bodythrust has no power anymore, it’s as if the characters density goes up after throwing the object.