Showing value on timer

  1. What do you want to achieve? Keep it simple and clear!

To see the amount of damage being dealt not like a pop up but a textlabel showing current value of it

  1. What is the issue? Include screenshots / videos if possible!

Well I’ve tried doing some research on the topic to see if theres a way to resolve it but so far haven’t found anything of the type

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked on the hub and also youtube/google but wasn’t helpful

Like a health bar? Is that what you are trying to implement?

A UI to see how much Damage you have dealt to the enemy

Hi, it all depends what kind of damage you want to display, but let’s say it’s the player’s character, when they change health.

Player.CharacterAdded:Connect(functio(Character)
	local Humanoid = Character:WaitForChild("Humanoid")
	Humanoid.HealthChanged:Connect(function()
		HealthTextLabel.Health = Humanoid.Health -- When the health changes
	end)
	HealthTextLabel.Health = Humanoid.Health -- When they spawn in
end)

I do have some code I can share to help with your post, but Im not on pc atm

Yeah like if the amount was 545 or 546m ect, it would then show the amount but then if none was done it would then return to 0 i could script it to show the value but would only show it and if it increased

What is your script so far? We’re not gonna create a full script for you. :slight_smile:

I could just send my whole tagging system I made a while ago when i get home, should work for this post lol

I am assuming you wanna get the amount of damage dealt on an NPC or another player.
You could get the original health of the other npc/player and then subtract it by its current health, something like this:

local originalHealth = Humanoid.Health -- this is the value of the original health of the player or npc
local textToDisplay = gui.TextLabel -- where you wanna display the damage output

Humanoid:GetPropertyChangedSignal("Health"):Connect(function() -- detects if the health has changed
     textToDisplay.Text =  originalHealth - Humanoid.Health
end)

This is a rough script, but hopefully it can help you a little.

The person would not learn anything by you doing so, but no-one is gonna stop you. :slight_smile:

I wasn’t asking for a full script, just to get some more knowledge about it and how to go about it

puts comments on each and every line explaining each thing and their functionality

I might just send snippets from it, and explain how I’d did it

Nico sent you a good bit of guidance on what you can do. But if you want the attacker to see how much damage they’ve done, you just fire a remote to their client, at the same spot in your code where you deal the damage to the target.

No no i was meaning for the player to be shown the output on there screen so they can see the amount of damage they are doing to like a npc and like per second so if i did 5 damage per hit and it took 1 second to do the damage it would show 5, or if it was 2 hits in the 1 second it would show 10, but im gonna have a look at what nico was explaining

Actually funny thing, i found the source code from one of my discord dms, except I cant take parts of it on phone, so out of luck from there

Yeah im currently on phone too aha

That is the same deal. In the weapon-script or whatever script you deal damage with, fire a remote to the player, telling them how much damage they did. You can find the Player in multiple ways, either by their character directly, or from the .Parent of the weapon ect.

Do you mean that you want it to show the DPS, and not only the damage? (Damage per second)

Yeah like if the player was to damage the npc over and over showing the DPS and not the damage being dealt

In the Script below you will be able to see the value of your health when you spawn in and also when you change your health.

To explain the script, it waits for the Humanoid to be spawned in then it checks if the Health has changed and if it has, it updates the HealthTextLabel.Text to the current Health amount.

Hope it helps.

But if its the player doing the damage it would show the amount done to the npc, but wouldn’t show the DPS for the second only the amount being