So I am developing a Health and Stamina bar. However, I have no clue how to debug it. For my stamina bar the bar goes out of the frame. And for my health bar, when damage is taken, it does not show the players health. I also tried to make it where it shows the players headshot of their avatar. Like this
Here is my Explorer Page
Stamina script:
local CAS = game:GetService("ContextActionService")
local RE = game:GetService("ReplicatedStorage"):WaitForChild("RE")
local fill = script.Parent:WaitForChild("top"):WaitForChild("fill")
local stam = 50
local speed = 16
local sprinting = false
local function sprint(str, state, object)
if stam < 1 then return end
speed = state == Enum.UserInputState.Begin and 24 or 16
sprinting = state == Enum.UserInputState.Begin
while sprinting and stam > 0 and wait(.1) do
stam = stam - 1
fill:TweenSize(UDim2.new(stam/50, 0, 1, 0), "Out", "Sine", .1, true)
RE:FireServer('sprint', {speed})
end
sprinting = false
speed = 16
RE:FireServer('sprint', {speed})
wait(1)
while not sprinting and stam < 50 and (wait(2)) do
fill:TweenSize(UDim2.new(stam/50, 0, 1, 0), "Out", "Sine", .1, true)
stam = stam + 1
end
while stam > 50 do stam = 50
end
end
CAS:BindAction("sprint", sprint, true, Enum.KeyCode.LeftShift)
Health Script:
local plr = game.Players.LocalPlayer.Character
local StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
while true do
script.Parent:TweenSize(UDim2.new(plr.Humanoid.Health/plr.Humanoid.MaxHealth, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1)
wait(0.1)
end
Avatar Image Script:
script.Parent.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=500&y=500&Format=Png&username=" ..game.Players.LocalPlayer.Name.. ""
Please help me, thank you.
