Here is a clip of what is happening
Im switching between tools.
Heres the part of the script.
local guiRenderstepFunction = function(deltaTime)
local Cloned = Player:WaitForChild("PlayerGui"):FindFirstChild("BlockingStamina")
if blocking then
if not StaminaGone or (StaminaGone and currentstamina > 0) then
StaminaGone = false
currentstamina = math.clamp(currentstamina - 30 * deltaTime, 0, stamina)
if currentstamina == 0 then
blocking = false
playanim:Stop()
BlockEvent:FireServer("Two")
StaminaGone = true
end
end
end
Cloned.Frame.BlockingStamina.Size = UDim2.new(currentstamina/stamina, 0, 1, 0)
end
local afterRenderStep = function(deltaTime)
local Cloned = Player:WaitForChild("PlayerGui"):FindFirstChild("BlockingStamina")
if not blocking then
if currentstamina < 100 then
currentstamina = math.clamp(currentstamina + 20 * deltaTime, 0, stamina)
end
end
Cloned.Frame.BlockingStamina.Size = UDim2.new(currentstamina/stamina, 0, 1, 0)
end
UIS.InputBegan:Connect(function(input, gameProcsessed)
local Cloned = Player:WaitForChild("PlayerGui"):FindFirstChild("BlockingStamina")
if on then
if gameProcsessed then return end
if equipped == false then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
blocking = true
BlockEvent:FireServer("One")
playanim:Play()
GuiSize = RunService.RenderStepped:Connect(guiRenderstepFunction)
if RegenGui then
RegenGui:Disconnect()
end
end
end
end)
UIS.InputEnded:Connect(function(input, IsTyping)
if IsTyping then return end
if not on then return end
if not equipped then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
blocking = false
BlockEvent:FireServer("Two")
playanim:Stop()
RegenGui = RunService.RenderStepped:Connect(afterRenderStep)
if GuiSize then
GuiSize:Disconnect()
end
end
end)
Tool.Unequipped:Connect(function()
local Cloned = Player:WaitForChild("PlayerGui"):FindFirstChild("BlockingStamina")
Cloned.Enabled = false
blocking = false
BlockEvent:FireServer("Two")
playanim:Stop()
if GuiSize then -- If i add the Other Function it just stopps it but doesnt do anything after that
GuiSize:Disconnect()
end
end)
Dont Judge on how the script is made.
