Hi I got a spring from the tool box that can make people jump really high..but I would like to put a time limit on it otherwise people will be jumping everywhere lol
Tried implementing a few things but doesn't work like
wait(15) hit.Parent.tool:Destroy()
but im not sure where to put it in the existing script or even if it is right or create another script …see below please help...im a noob lol!!
Tool = script.Parent Handle = Tool:WaitForChild("Handle") CoilSound = Handle:WaitForChild("CoilSound")
EqualizingForce = (236 / 1.2) -- amount of force required to levitate a mass Gravity = 0.75 -- things float at > 1
GhostEffect = nil MassCon1 = nil MassCon2 = nil
function GetTotalMass(Parent) local TotalMass = 0 local function RecursiveGetMass(Parent) for i, v in pairs(Parent:GetChildren()) do if v:IsA("BasePart") and (v.Position - Character:GetModelCFrame().p).magnitude < 10 then if v.Name == "Handle" then TotalMass = (TotalMass + (v:GetMass() * EqualizingForce * 1)) else TotalMass = (TotalMass + (v:GetMass() * EqualizingForce * Gravity)) end end RecursiveGetMass(v) end end RecursiveGetMass(Parent) TotalMass = TotalMass * 1.125 return TotalMass end
function OnMassChanged(child, character) if GhostEffect and GhostEffect.Parent then GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0) end end
function UpdateGhostState(Unequipped) if Unequipped then GhostEffect:Destroy() GhostEffect = nil MassCon1:disconnect() MassCon2:disconnect() else if not GhostEffect then GhostEffect = Instance.new("BodyForce") GhostEffect.Name = "GravityCoilEffect" GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0) GhostEffect.Parent = Head MassCon1 = Character.ChildAdded:connect(function(Child) OnMassChanged(Child, Character) end) MassCon2 = Character.ChildRemoved:connect(function(Child) OnMassChanged(Child, Character) end) end end end
function OnEquipped() Character = Tool.Parent Head = Character:FindFirstChild("Head") if not Head or not Head.Parent then return end CoilSound:Play() UpdateGhostState(false) end
function OnUnequipped() UpdateGhostState(true) end
Tool.Equipped:connect(OnEquipped) Tool.Unequipped:connect(OnUnequipped)
Closed as Not Constructive by User#23365, xPolarium, and User#19524
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?