Working on a skip stage for my obby. Let's say player A has used his 3 skips, but when he dies, he gets the 3 skips back without waiting 2 minutes to get new skip. I'm using a local script.
local player = game.Players.LocalPlayer local stage = player:WaitForChild("leaderstats"):FindFirstChild("Stage") local skipped = player:WaitForChild("leaderstats"):FindFirstChild("StageSkipped") local skipLimit = player:WaitForChild("Skip") local originalLimit = 3 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..")" script.Parent.MouseButton1Click:Connect(function() if originalLimit ~= 0 then originalLimit = originalLimit - 1 stage.Value = stage.Value + 1 skipped.Value = skipped.Value + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " if player ~= nil and player.Character ~= nil and player.Character:FindFirstChild("Humanoid").Health > 0 then player.Character.HumanoidRootPart.CFrame = game.Workspace.CheckPoints:FindFirstChild(stage.Value).CFrame + Vector3.new(0,3,0) end elseif originalLimit == 0 and skipLimit.Value ~= 0 then skipLimit.Value = skipLimit.Value - 1 stage.Value = stage.Value + 1 skipped.Value = skipped.Value + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " if player ~= nil and player.Character ~= nil and player.Character:FindFirstChild("Humanoid").Health > 0 then player.Character.HumanoidRootPart.CFrame = game.Workspace.CheckPoints:FindFirstChild(stage.Value).CFrame + Vector3.new(0,3,0) end end end) while wait(120) do --120 means 2 minutes if originalLimit < 3 then --if the originalLimit variable is less then 3 it will add 1 to it every 2 minutes originalLimit = originalLimit + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " end end
Any help or suggestions would be great! Thanks!
First of all there should be a respawn timer before the player skips back and add a humanoid then add a CharacterAutoLoads and turn it false after 2 minutes it turns the CharacterAutoLoads to true and anyways time for the fix
local player = game.Players.LocalPlayer local stage = player:WaitForChild("leaderstats"):FindFirstChild("Stage") local skipped = player:WaitForChild("leaderstats"):FindFirstChild("StageSkipped") local skipLimit = player:WaitForChild("Skip") local originalLimit = 3 local hum = player.Character:WaitForChild("Humanoid") script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..")" script.Parent.MouseButton1Click:Connect(function() if originalLimit ~= 0 then originalLimit = originalLimit - 1 stage.Value = stage.Value + 1 skipped.Value = skipped.Value + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " if player ~= nil and player.Character ~= nil and player.Character:FindFirstChild("Humanoid").Health > 0 then player.Character.HumanoidRootPart.CFrame = game.Workspace.CheckPoints:FindFirstChild(stage.Value).CFrame + Vector3.new(0,3,0) end elseif originalLimit == 0 and skipLimit.Value ~= 0 then skipLimit.Value = skipLimit.Value - 1 stage.Value = stage.Value + 1 skipped.Value = skipped.Value + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " if player ~= nil and player.Character ~= nil and player.Character:FindFirstChild("Humanoid").Health > 0 then player.Character.HumanoidRootPart.CFrame = game.Workspace.CheckPoints:FindFirstChild(stage.Value).CFrame + Vector3.new(0,3,0) end end end) hum.Died:connect(function() player.Parent.CharacterAutoLoads = false wait(120) if originalLimit < 3 then --if the originalLimit variable is less then 3 it will add 1 to it every 2 minutes originalLimit = originalLimit + 1 script.Parent.Text = "Skip Stage: ("..originalLimit + skipLimit.Value..") " player.Parent.CharacterAutoLoads = true end end)