#can someone tell me wat i did wrong

55 messages · Page 1 of 1 (latest)

alpine sinew
#

local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local humanoid = Character:Waitforchild("humanoid")

local frame = script.Parent.Parent:FindFirstChild("HealthH")

local function updateHealthBar(health)
local maxHealth = humanoid.health
local health = humanoid.maxhealth
local frame = UDim2.new(health / 100, 0, 0.05, 0)

end

polar hare
#

all you did is set up variables and never use them

alpine sinew
#

?

#

wym

summer wagon
#

and

#

yeah

#

you're just defining variables

alpine sinew
#

of

#

oh

#

so where should ii put a functiob

solid whale
#

where did you get this script

alpine sinew
#

i made it i jus started scriptin yesterday

eager oracleBOT
#

studio** You are now Level 2! **studio

solid whale
#

you never call the function

#

thats why

alpine sinew
#

wheer do i call the function

solid whale
#

you want the scrpt to update a gui to the players health right?

alpine sinew
#

yea

solid whale
#
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait() 
local humanoid = Character:Waitforchild("humanoid")

local frame = script.Parent.Parent:FindFirstChild("HealthH")

local function updateHealthBar(health)
    local maxHealth = humanoid.health
    local health = humanoid.maxhealth
    local frame = UDim2.new(health / 100, 0, 0.05, 0)
end

while task.wait() do
updateHealth(player.Character.Humanoid.Health)
end
#

try this

alpine sinew
#

it didnt work

solid whale
#

no errors?

#

oh wait

#

ohh

summer wagon
#

yeah

#

they arent doing anything

#

just setting varialbes

solid whale
#
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait() 
local humanoid = Character:Waitforchild("humanoid")

local frame = script.Parent.Parent:FindFirstChild("HealthH")

local function updateHealthBar()
    local maxHealth = humanoid.Maxhealth
    local health = humanoid.Health
    local frame = UDim2.new(humanoid.Health / 100, 0, 0.05, 0)
end

while task.wait() do
updateHealth()
end
#

try this

summer wagon
#

no

#

that just

solid whale
#

ur max health and health variables were flipped

summer wagon
#

you're still doing the same thing

solid whale
#

no

summer wagon
#

you're only setting variables

solid whale
#

bro look at bottom

summer wagon
#

no

solid whale
#

updateHealth()

summer wagon
#

in the function

#

all you're doing is setting varialbes

solid whale
#

💀oh

#

nvm

#

ur right

#

ty pro scripter

#
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait() 
local humanoid = Character:Waitforchild("humanoid")

local frame = script.Parent.Parent:FindFirstChild("HealthH")

local function updateHealthBar()
    frame.Size = UDim2.new(humanoid.Health / 100, 0, 0.05, 0)
end

while task.wait() do
updateHealth()
end
#

is it frame.Size?

#

idek anymore

alpine sinew
#

it jus said dis

summer wagon
#

its :WaitForChild, not :Waitforchild

#

its "Humanoid", not "humanoid"

#

you should use humanoid..Changed:Connect(updateHealthBar) instead of every tick

#

etc