Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TabGlobal = Window:CreateTab("Global", 4483362458)
- local secStamina = TabGlobal:CreateSection("Stamina")
- local stam = {
- on = cfg.get("stamOn", false),
- loss = cfg.get("stamLoss", 10),
- gain = cfg.get("stamGain", 20),
- max = cfg.get("stamMax", 100),
- current = cfg.get("stamCurrent", 100),
- noLoss = cfg.get("stamNoLoss", false),
- thread = nil,
- }
- local function stamModule()
- local ok, m = pcall(function() return require(svc.RS.Systems.Character.Game.Sprinting) end)
- return ok and m or nil
- end
- local function stamIsKiller()
- local ch = lp.Character; if not ch then return false end
- local kf = getTeamFolder("Killers")
- return kf and ch:IsDescendantOf(kf)
- end
- local function stamIsEnraged()
- local ch = lp.Character; if not ch then return false end
- local kf = getTeamFolder("Killers"); if not (kf and ch:IsDescendantOf(kf)) then return false end
- for _, v in ipairs(ch:GetDescendants()) do
- if v:IsA("NumberValue") and v.Name == "ENRAGED" then return true end
- end
- return false
- end
- local function stamApply()
- local m = stamModule(); if not m then return end
- if not m.DefaultsSet then pcall(function() m.Init() end) end
- if stamIsEnraged() then
- m.StaminaCap = nil
- return
- end
- local forceNoLoss = stam.noLoss or stamIsKiller()
- m.StaminaLoss = stam.loss
- m.StaminaGain = stam.gain
- m.MaxStamina = stam.max
- m.StaminaCap = nil
- m.StaminaLossDisabled = forceNoLoss
- if m.Stamina and m.Stamina > stam.max then m.Stamina = stam.current end
- pcall(function() if m.__staminaChangedEvent then m.__staminaChangedEvent:Fire() end end)
- end
- local function stamStart()
- if stam.thread then return end
- stam.thread = task.spawn(function()
- while stam.on do
- if lp.Character and lp.Character:FindFirstChild("HumanoidRootPart") then stamApply() end
- task.wait(0.5)
- end; stam.thread = nil
- end)
- end
- local function stamStop()
- stam.on = false
- if stam.thread then task.cancel(stam.thread); stam.thread = nil end
- end
- secStamina:CreateToggle({
- Name = "Custom Stamina",
- CurrentValue = stam.on,
- Callback = function(on)
- stam.on = on; cfg.set("stamOn", on); if on then stamStart() else stamStop() end
- end
- })
- secStamina:CreateSlider({
- Name = "Loss Rate",
- Range = {0, 50},
- Increment = 1,
- CurrentValue = stam.loss,
- Callback = function(v) stam.loss = v; cfg.set("stamLoss", v) end
- })
- secStamina:CreateSlider({
- Name = "Gain Rate",
- Range = {0, 50},
- Increment = 1,
- CurrentValue = stam.gain,
- Callback = function(v) stam.gain = v; cfg.set("stamGain", v) end
- })
- secStamina:CreateSlider({
- Name = "Max Pool",
- Range = {50, 500},
- Increment = 1,
- CurrentValue = stam.max,
- Callback = function(v) stam.max = v; cfg.set("stamMax", v) end
- })
- secStamina:CreateSlider({
- Name = "Current Value",
- Range = {0, 500},
- Increment = 1,
- CurrentValue = stam.current,
- Callback = function(v) stam.current = v; cfg.set("stamCurrent", v) end
- })
- secStamina:CreateToggle({
- Name = "Infinite Stamina",
- CurrentValue = stam.noLoss,
- Callback = function(on)
- stam.noLoss = on; cfg.set("stamNoLoss", on); stamApply();
- if on and not stam.on then stam.on = true; stamStart() end
- end
- })
- if stam.on then stamStart() end
- lp.CharacterAdded:Connect(function()
- task.delay(1.5, function()
- if stam.on then stamApply(); if not stam.thread then stamStart() end end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment