Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Wait for player to touch part and restore his jumppower ability?

Asked by 3 years ago

Young to scripting and can't figure this out. So I made this script and when the player comes in touch with Part, it disables his/her JumpPower. Now, I can put another script in the part called "EnableJump" and simply change "hum.JumpPower = 0" to 50 but I don't want to use many scripts. How can I make it so that this script does its job, sets the player's JumpPower to 0 and then waits for the player to touch EnableJump and when EnableJump is touched the JumpPower goes back up to 50.

local EnableJump = script.Parent.Parent.Parent.Four.EnableJump

function touch(hit)
local hum = hit.Parent:FindFirstChild("Humanoid") 
    if hum then 
       hum.JumpPower = 0
    -- MISSING PART
    end
end

script.Parent.Touched:Connect(touch)
0
i don't know how to solve this FragSpamming 0 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Write another function that sets the JumpPower back to 50 and connect it to EnableJump.Touched.

0
Sorry, didn't mean to accept. I'll try that but not exactly what I'm looking for. Thanks though! ItsJZaid 45 — 3y
Ad

Answer this question