Server shows incoming damage to the player, but client does not

1. What do you want to achieve?
I want to manage object interactions using tags and CollectionService in Roblox, and ensure that damage to player characters is correctly reflected on both the server and client when scripts are placed in ServerScriptService instead of Workspace.

2. What is the issue?
When I place my script in Workspace, everything works fine—the damage is visible on both the server and the client. However, when I move the same script to ServerScriptService, the client doesn’t reflect the incoming damage until the character resets. I need the client to display damage in real-time, just as it does when the script is in Workspace.

3. What solutions have you tried so far?

  • I have added debug prints to ensure the script runs and applies damage correctly.
  • I have verified that the tags are applied correctly to the objects.
  • I have tried refining the debounce logic to ensure it handles multiple touch events correctly.
  • I looked into client-server communication but need guidance on implementing it effectively for real-time updates.

Code Example:

Here is the script I am using:

CollectionService = game:GetService("CollectionService")
local Tag = "KillBrick"
local debounce = false

-- KillFunction
function KillFunction(Part: BasePart)
	Part.Touched:Connect(function(hit)
		local Humanoid = hit.Parent:FindFirstChild("Humanoid")

		if Humanoid and debounce == false then
			debounce = true
			task.wait()
			Humanoid:TakeDamage(5) 
			debounce = false
		end
	end)
end


-- Initialize Existing Kill Bricks
for i, v in pairs(CollectionService:GetTagged(Tag)) do
	KillFunction(v)
end

-- Connect to New Kill Bricks
CollectionService:GetInstanceAddedSignal(Tag):Connect(KillFunction)

Additional Details:

  • The script works perfectly when placed in Workspace, but fails to show immediate damage updates on the client when moved to ServerScriptService.
  • I suspect it has something to do with client-side visual feedback not being updated in real-time.
  • If possible, I really wish not to use “RemoteEvents” for this issue.

Any insights or suggestions on how to solve this issue would be greatly appreciated! And thank you for reading!

I also made a small gif, to show the issue.
94fa3ed163c706a4897cb96db79e002c

1 Like

There are reports that the health bar is missing above the player’s head a couple days ago. They claimed to have “fixed” it but I still fail to see my own health bar above my own head.

if you click on the 3D looking cube button next to your chat, do you see a health bar there?

When I press 3d cube it does show up… Wait, so its a roblox issue?

Hi, thanks for posting this bug report! I think the issue is that the health bar UI is not showing even thought the local player’s Humanoid.Health < MaxHealth.

If possible, could you double check that the Humanoid.Health is less than MaxHealth on the client?
Also do you have a reliable repro place?
I was able to repro with about 50% success in Studio, but not on the client.

I also forwarded this bug to the appropriate team!

I believe the expected behavior is that the local player’s Humanoid should hide the overhead health bar + name, and the health bar is instead shown at the top right (old TopBar) or top left (new TopBar). The overhead health bar + name should be shown for other Humanoids though.

Were you seeing an overhead health bar for your character at some point?

I mean, the weird part is right. if I reset then it does work. Same goes for if the script is placed in workspace then the issue got solved.

There seem to be just a issue to only see it serverly updated when the script is in serverscriptservice.

Hi stadium_parkour2,

Thank you for looking into this issue. I’ve attached the .rbxl file for you to examine the problem directly. Below are the details and steps to reliably reproduce the issue:

The image below would show you where the script is located. I hope this helps!

image
KillBrickHandler.rbxl (59.4 KB)

Beside of that, I believe the health be changed ye. But it will not be visible toward the player expect if you open that 3d cube. On that one it does show but not the normal health bar.

And ofcourse thank you for letting roblox know! It means a lot.

1 Like

Hi PixelCrypth! Happy to report that we found a fix for this bug, though it make take a little while for it to roll out. In the meantime, I’m fairly certain that this issue is studio-only, so there shouldn’t be any impact on your players. Thanks for the bug report!

1 Like

Hi QuirkySquid,

Thank you so much for the update and for looking into this issue! I’m glad to hear that a fix has been identified. I really appreciate the team’s efforts in resolving this.

It’s a relief to know that this issue is studio-only and won’t impact the players. Your prompt response and assistance mean a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.