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

Part 2 of My Reset Prevention: More Problems? Seems Simple But Cannot Solve?

Asked by 7 years ago
Edited 7 years ago

Hey fellow ROBLOXian scripters. I'm working on this game, called Hoop Dreams, basically a basketball game with some few minor twists. It seems really complicated but it's not, I want the script to work so that when I touch the brick, it will not make my character die, it keeps doing that. I have my own reset preventer, but it only works when I do not step on the part. Please help! Thanks.

-- this is the problem I'm having (this is the part I step onto)
local d = true -- d = debounce
script.Parent.Touched:connect(function(hit)
    if d and hit.Parent:FindFirstChild("Humanoid") and script.Parent.BrickColor~=BrickColor.Green() then
        d=false
        local plr=game.Players:FindFirstChild(hit.Parent.Name)
        hit.Parent.Humanoid.WalkSpeed=0
        script.Parent.BrickColor=BrickColor.Green()
        plr.Court.Value = script.Parent.Parent.Name
        script.Parent.Parent.gotnext.Value = script.Parent.Parent.gotnext.Value + 1
        plr.PlayerGui.scoreboard:findFirstChild(script.Parent.Parent.Name).Visible=true
        plr.TeamColor=BrickColor.DarkGray()
    wait()
        d=true
    end
end)

-- This is the reset prevention
local plr = game.Players.LocalPlayer repeat wait() until plr.Character and plr.Character:FindFirstChild("Humanoid")
local hum = plr.Character['Humanoid'] 
hum.HealthChanged:connect(function(health)
    if health == 0 then 
    hum.Health = hum.MaxHealth plr.Character:MakeJoints()
    end 
end) 

-LukeGabrieI

P.S. Basically once I step onto it, it does not prevent my death. But when I don't step on it and try to reset my character, I do not die. But when I step onto this part (first script) it makes me reset.

1 answer

Log in to vote
0
Answered by 7 years ago
game:GetService'StarterGui':SetCore('ResetButtonCallback', false)

-Found my own answer to this problem lol

Ad

Answer this question