local HealthDisplay = game.ServerStorage:WaitForChild("HealthGui")
local HealthText = HealthDisplay.TextLabel
----------<TIME>-------------
local timeDisplay = game.ServerStorage:WaitForChild("TimeGui")
local timeText = timeDisplay.TextLabel
-------------------------><CLONE DISPLAY><-----------------------------
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
----------------- HEALTH DISPLAY --------------------
local character = plr.Character
local head = character:FindFirstChild("Head")
local humanoid = character:FindFirstChild("Humanoid")
----------------------- <>-------------------------------------------------- TIME DISPLAY ---------------------------- local leaderstats = plr:FindFirstChild("leaderstats") local Time = leaderstats:WaitForChild("Time Alive") ----------------------------------------------------------- local tD = timeDisplay:Clone() tD.Parent = head tD.Adornee = head tD.TextLabel.Text = Time.Value local Display = HealthDisplay:Clone() Display.Parent = head Display.Adornee = head local HealthText = Display:WaitForChild("TextLabel") HealthText.Text = humanoid.Health.." HP" if humanoid.Health >= 60 then HealthText.TextColor3 = Color3. fromRGB(99, 255, 99) end if humanoid.Health <= 60 then HealthText.TextColor3 = Color3. fromRGB(255, 253, 130) end if humanoid.Health <= 30 then HealthText.TextColor3 = Color3. fromRGB(255, 52, 55) end end)end)
#How to fix this code?
1 messages · Page 1 of 1 (latest)
whats the issue with it?
can i see the error
There isnt an error
It just doesnt display
gimme a sec ill send a video
I just started scripting today and i got help from some other guys but i understand the code
im just new to the basics like how to identify the instances in another script
it seems you dont keep updating the td.textlabel.text
you only set it once
when time.value is at 0
put it in a loop
using heartbeat or renderstepped
oh thats right
how do i do a heartbeat?
heartbeat()
local tD = timeDisplay:Clone()
tD.Parent = head
tD.Adornee = head
tD.TextLabel.Text = Time.Value
return end?
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function
--code here
end)
oh wow
it runs every physic tick
thanks for teaching me
i think its 60 times per secound
so it is 60 fps of running the players time right?
tps i mean
do you think there is an easier way?
it will update the player time label 60 times per seocund
just put this inside it
tD.TextLabel.Text = Time.Value
oh ok
it shouldwork
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function () local tD = timeDisplay:Clone() tD.Parent = head tD.Adornee = head tD.TextLabel.Text = Time.Value end)
made it like this
oh ok
you only need to update the value
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function ()
tD.TextLabel.Text = Time.Value
end)
local RunService = game:GetService("RunService")
local tD = timeDisplay:Clone()
tD.Parent = head
tD.Adornee = head
RunService.Heartbeat:Connect(function ()tD.TextLabel.Text = Time.Value end)
this ok?
yeah
no problem
i ahve one more question
does roblox automatically abbreviate
million or billion?
im not quite sure but i would assume not
31 years
yeah crazy
** You are now Level 5! **