Trying to make it so a player has an interval between uses of the health boosting ability?
It all works besides line 67 which I can't figure out what I need to put there so that a player can not just use the healing ability without any limitations.
Here's the script:
THANK YOU SO MUCH IN ADVANCE!
002 | local offset = Vector 3. new( 40 , 80 , 0 ) |
004 | local plr = game.Players.LocalPlayer |
006 | local sg = game:GetService( "StarterGui" ) |
008 | sg:SetCore( "TopbarEnabled" , false ) |
010 | local mouse = plr:GetMouse() |
012 | local hmnd = plr.Character:FindFirstChild( "Humanoid" ) |
014 | hmnd.MaxHealth = script.MAXHP.Value |
018 | hmnd.AutoRotate = false |
020 | local cam = game.Workspace.CurrentCamera |
026 | local runService = game:GetService( "RunService" ) |
028 | sg:SetCore( "TopbarEnabled" , false ) |
031 | hmnd.WalkSpeed = speedval |
033 | local function onRenderStep() |
034 | local pos = plr.Character.Torso.Position |
035 | local campos = pos + offset |
036 | cam.CoordinateFrame = CFrame.new(campos, pos) |
037 | plr.Character.Torso.CFrame = CFrame.new(plr.Character.Torso.Position,Vector 3. new(mouse.Hit.p.X, plr.Character.Torso.Position.Y, mouse.Hit.p.Z)) |
040 | runService:BindToRenderStep( 'Camera' , Enum.RenderPriority.Camera.Value, onRenderStep) |
046 | uis = game:GetService( "UserInputService" ) |
048 | local canBeUsed = false |
050 | function hpRegen(inputObject, gameProcessedEvent) |
051 | if inputObject.KeyCode = = Enum.KeyCode.Q and hmnd.Health < hmnd.MaxHealth and canBeUsed = = true then |
053 | local hp = hmnd.Health |
054 | local increase = script.HPBOOST.Value |
055 | hmnd.Health = math.min(hmnd.Health + increase, hmnd.MaxHealth) |
056 | local hpfxone = game.ServerStorage.hpgaineffect:Clone() |
057 | hpfxone.Parent = plr.Character.Torso |
058 | local hpfxtwo = game.ServerStorage.hpgaineffect:Clone() |
059 | hpfxtwo.Parent = plr.Character.Torso |
060 | local fire = game.ServerStorage.hpfire:Clone() |
061 | fire.Parent = plr.Character.Torso |
077 | function speedUpgrade(inputObject, gameProcessedEvent, placetime, timewaited) |
078 | if inputObject.KeyCode = = Enum.KeyCode.LeftShift and canBeUsed = = true then |
081 | while hmnd.WalkSpeed > 18.5 do |
083 | hmnd.WalkSpeed = hmnd.WalkSpeed - 1.25 |
085 | if hmnd.WalkSpeed = = 17.5 then |
100 | function speedUpgradeEnd() |
101 | hmnd.WalkSpeed = script.DEFAULTSPEED.Value |
106 | uis.InputBegan:connect(hpRegen) |
107 | uis.InputBegan:connect(speedUpgrade) |
108 | uis.InputEnded:connect(speedUpgradeEnd) |