So i have a take damage script for my punch

i have a take damage script, and i have a punch tool with a script that’s meant to do damage to the player, and depending on their attack the outcome of the damage to the player, but i don’t know how to make a pop up that would show the damage dealt by the player, onto a dummy or onto a player, i can punch a player and they take damage, it doesn’t show the amount, but the player dies

2 Likes

Use a BillboardGui | Roblox Creator Documentation on the character to display the damage each time it occurs. On damage → Show Billboard with text label holding dmg value, then hide the billboard again.

2 Likes

As the post above said, you can do this with a Billboardgui inserted to rootpart of the player or any part of it, also can you show us your Punch script?

2 Likes

yeah i have a billboardgui with a text label, and yeah sure

1 Like
local TakeDamage = game:GetService("ReplicatedStorage").FireTakeDamage

script.Parent.Parent.Activated:Connect(function()
	local char = script.Parent.Parent.Parent

	if char.Parent == workspace then
    	local player = game.Players:GetPlayerFromCharacter(char)
    	local dmg = player.Strength.Value
	
    	script.Parent.Touched:Connect(function(hit)
	    	if hit.Parent ~= char then
	    		if game.Players:GetPlayerFromCharacter(hit.Parent) then
	    			TakeDamage:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent), player)
	    		end
	    	end
    	end)
	end
end)

1 Like

Can you show the script that works when remote fires too

local event = game:GetService("ReplicatedStorage").TakeDamage

event.OnServerEvent:Connect(function(player, hitBy)
	local char = player.Character
	local hitByStrength = hitBy.Strength.Value
	local endurance = player.Endurance.Value
	local hitByChar = hitBy.Character
	
	if not player.Safe.Value and not hitBy.Safe.Value then
		if endurance > hitByStrength * 10 then
			hitByChar.Humanoid.Health = 0
		elseif endurance > hitByStrength then
			hitByChar.Humanoid:TakeDamage(hitByStrength * 0.1)
			char.Humanoid:TakeDamage(hitByStrength * 0.9)
		else
			char.Humanoid:TakeDamage(hitByStrength)
		end
	end
end)

the TakeDamage?

So right after the char.Humanoid.TakeDamage() call put in another line to make the billboard for that character visible. Then set the text label of that billboard to the damage amount, wait a second, then make the billboard invisible again. That’s the very basic idea anyway. You may end up wanting to create a new billboard each time and stack them them and destroy after a second. Or deactivate the last hide if damage was dealt again.

after that event? i then put in the code

Not after the event, right then after the line.

Hmm ill give it a shot, but might be a little messy

yeah it didn’t seam to work out, i dunno if its cause i have another one for the head or not

Post your script with the changes you made, let’s see what its looking like.

I’m not currently at my pc, but the numbers don’t show up, the text doesn’t change

I have a billboard for the player, that’s always on top of them to show numbers, but that’s for something else I don’t know if that would intervene with it

All I’m tryna make the other one do, is when the player punches the other player, the damage is shown

where should i put the billboardgui?