Need help changing a text label to whats in an IntValue

I’m fairly new to lua but i’ve been learning for a few months
I tried to make this live system but no matter what i do it doesn’t change the Text labels text?

it works where the server script counts the times you die and each time you die it fires a remote to a local script that changes the guihm

--this is the local script
local PlayerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local Gui = PlayerGui:WaitForChild('lifeLostGui')
local Frames = Gui.LifeLostFrame.Frame2
local Lives = Frames:WaitForChild('LiveLabel')
local Int = game:WaitForChild('Players').LocalPlayer.Lives.Value

local remote = game.ReplicatedStorage.Liveslost
	local guiobject = Lives 
	remote.OnClientEvent:connect(function ()
	Lives.Text = (Int)
	
end)
-- this is the server script
local Remote = game.ReplicatedStorage.Liveslost
game.Players.PlayerAdded:Connect(function(Player)
	
	local Lives = game.ReplicatedStorage.Lives
	Lives.Parent = Player

	Player.CharacterAdded:Connect(function(Character)
		Character.Humanoid.Died:Connect(function()
			if Lives.Value > 0 then
				Lives.Value -= 1
				print(Lives.Value)
				Remote:FireClient(Player)
			else
				print('FullDead')
			end
			
	
		
		end)
	end)
end)

You only fire this event if the character is fully dead, and if there are errors in the output, what are they?

there are none so i didnt know what to do from there

1 Like

would that just be checking the humanoid health?

I read it wrong, it is firing when the player has more than 0 lives. It would make more sense to clone lives then put it in the player, that way more people can have lives, not just 1. Also, send the value of the lives through the remote event instead of defining it in the beginning of the script. Then you can change the text to the value sent through the remote event.

By sending it through the remote do you mean setting the value via script instead of properties?

If you are changing the value of the TextLabel for the person themself, you don’t need to use server at all.
You can do something simple like

local PlayerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local Gui = PlayerGui:WaitForChild('lifeLostGui')
local Frames = Gui.LifeLostFrame.Frame2
local Lives = Frames:WaitForChild('LiveLabel')
local Int = game:WaitForChild('Players').LocalPlayer.Lives.Value
local plr = game.Players.LocalPlayer

LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
   Lives.Text = "You have ".. tostring(int) .. "health"
end)
1 Like

Thank you! it made it so much simpler

This is the finished script

local PlayerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local Gui = PlayerGui:WaitForChild('lifeLostGui')
local Frames = Gui.LifeLostFrame.Frame2
local Lives = Frames:WaitForChild('LiveLabel')
local LocalPlayer = game:GetService('Players').LocalPlayer
local Int = game.ReplicatedStorage:WaitForChild('Lives')
local Players = game.Players



LocalPlayer.Character.Humanoid.Died:Connect(function()
	if Int.Value >0 then
		Int.Value -= 1
		wait(1)
		Lives.Text = (Int.Value) 
	end	
	if Int.Value == 0 then
		print('FullDead')
	end
end)