Making jump power back to what it was before

this script launches the player into the air and sets the jump power back to normal, is it possible that instead of setting the jumppower back to default it sets it to what it was before you jumped on it? because my game works with different jump powers and when i use this itll mess it up.

local toggle = false --keep at false
local config = script.Parent:FindFirstChild("Configure") --finds Configure
local thrustlife = config:FindFirstChild("ThrustLifeTime").Value --Finds thrust life time
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not toggle then
			toggle = true --dont touch
			local pad = script.Parent
			pad.BrickColor = BrickColor.new("Black") --change pad color
			pad.Material = ("Plastic") --change material color
			local trail = config:FindFirstChild("JumpPadDust"):Clone()
			trail.Parent = hit.Parent:FindFirstChild("HumanoidRootPart")
			local thrust = Instance.new("BodyThrust")
			thrust.Force = Vector3.new(0,0,-2550) --PushForce
			----------Animation--------------
			--local animation = Instance.new("Animation")
			--animation.AnimationId = ("rbxassetid://00")
			--animation.Parent = hit.Parent
			--local loadedanim = hit.Parent:FindFirstChild("Humanoid"):LoadAnimation(animation)
			--loadedanim:Play()
			
			--[Add an animation if you know what you're doing]--
			---------------------------------
			thrust.Parent = hit.Parent:FindFirstChild("HumanoidRootPart")
			hit.Parent:FindFirstChild("Humanoid").JumpPower = config:FindFirstChild("JumpHeight").Value
			hit.Parent:FindFirstChild("Humanoid").Jump = true
			pad.activate:Play()
			game.Debris:AddItem(thrust, thrustlife) --Push force life time
			game.Debris:AddItem(trail, 2) --Smoke effect life time
			wait(2)
			hit.Parent:FindFirstChild("Humanoid").JumpPower = 50 --dont touch
			--loadedanim:Stop()
			wait(.5)
			pad.BrickColor = BrickColor.new("Forest green")
			pad.Material = ("Neon")
			--animation:Destroy()
			toggle = false
		end
	end
end)
		
1 Like

You can save it to a variable before your changes and then revert the jumppower to that variable.

how? (30 characters) (30 characters again)

When the toggle var is set to true add a line and say: local oldJumpPower = hit.Parent.Humanoid.JumpPower

And when you set toggle back to false you’d add a line under that and say: hit.Parent.Humanoid.JumpPower = oldJumpPower

can you add it into the script? i dont wanna mess it up

If you follow my instructions you will figure it out. Scripting Support isn’t a place to get code written for you. You are not going to learn this way.

1 Like

well yeah but i already got a full script, it just needs some changing. my scripter isnt avaible at the moment so i asked this site

The DevForum is not a place where you should expect to be spoon-fed answers or full-bodied scripts.

1 Like

again, i already have a full script, it just needs a change…

The change you need has been fully described by @MauroNr1, all you need to do is apply the information given to you :slight_smile:

2 Likes

I’ve made changes a tiny change to the instructions, it now says exactly where to put the line. If this still doesn’t help, please consider attempting to contact your scripter or hiring a new one for the mean time.

Edit: It seems that you’ve created alot of topics today, and in almost everyone of those you are asking for somebody to write it for you. My bolded statements once again would be a solution to this.

2 Likes

yea its going bad at development… my scripter is taking a break and was supossed to come yesterday but didnt, i have to keep delayin an update because of him. in the meanwhile i make some stuff on my own but its hard without a scripter so yeah i use this site to help

and i also cant seem to find the toggle var thing

This is it. Simply place local oldJumpPower = hit.Parent.Humanoid.JumpPower under it.

And the other one, place hit.Parent.Humanoid.JumpPower = oldJumpPower under that one.

2 Likes

it worked! can you help me with my other topics maybe?