I want to make it so when the tool is equipped, whenever the player jumps, their gravity is reduced and they can jump higher.
Script:
function jump()
local Game = game
local Workspace = workspace
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid") or Character:WaitForChild("Humanoid")
local RootPart = Humanoid.RootPart or Humanoid:GetPropertyChangedSignal("RootPart"):Wait()
if not RootPart then RootPart = Humanoid.RootPart end
local Mass = 0
for _, Descendant in ipairs(Character:GetDescendants()) do
if not (Descendant:IsA("BasePart")) then continue end
Mass += Descendant:GetMass()
end
local BodyForce = Instance.new("BodyForce")
BodyForce.Force = Vector3.new(0, Mass / 2 * Workspace.Gravity, 0)
BodyForce.Parent = RootPart
end
local plr = game.Players.LocalPlayer
local char = plr.Character:WaitForChild("Humanoid")
local tool = script.Parent
if tool.Equipped then
char.JumpPower = 100
char.Jumped:Connect(jump)
end