Need help with a problem in my script

Hello, I Have a problem with my script, i made a script that counts the player’s torso size to make a game like Agario, so the problem is the other players can’t see others’ size, If you can help please reply.

My POV: Another player’s POV:
image

image

6 Likes

Are you updating them with a local script, if so this only makes the changes on the one client. It needs to be done on the server, or every client individually

4 Likes

i tried both, local script and script, i tried local script first in startercharacter and StarterGUI, didn’t work, and tried script in serverscriptservice, didn’t work too, what should i do?

2 Likes

Is the gui on the actual character in workspace? If so when using a server script is it updating on that specific client

1 Like

Do you mean the billboard???

1 Like

Yes, I mean the billboard gui.

2 Likes

can you show us your workspace and code,

2 Likes

the code is in the post, and i mean the sizecounter

image

3 Likes

the code is NOT in the post :thinking:

5 Likes

Ok first off, you didnt put your code in the post, unless its invisible.
Second what you should do is this:
With a server script whenever a players character is added, add the billboard GUI to it, then when ever their score or whatever changes, update the text there.

4 Likes

Sorry i forgot to post the code

– Place this script in a Script inside ServerScriptService

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoidRootPart = character:WaitForChild(“HumanoidRootPart”)

	-- Create the BillboardGui
	local billboardGui = Instance.new("BillboardGui")
	billboardGui.Name = "BillboardGui"
	billboardGui.Size = UDim2.new(0, 200, 0, 50) -- Adjust size as needed
	billboardGui.StudsOffset = Vector3.new(0, 5, 0) -- Position above the player
	billboardGui.AlwaysOnTop = true
	billboardGui.Parent = humanoidRootPart

	-- Create the TextLabel
	local textLabel = Instance.new("TextLabel")
	textLabel.Name = "TextLabel"
	textLabel.Size = UDim2.new(1, 0, 1, 0)
	textLabel.BackgroundTransparency = 1
	textLabel.TextColor3 = Color3.new(1, 1, 1) -- Set text color
	textLabel.TextStrokeTransparency = 0.5
	textLabel.TextScaled = true -- Ensure text scales properly
	textLabel.Text = "" -- Initialize with an empty string
	textLabel.Parent = billboardGui

	-- Function to update the TextLabel with the torso size
	local function updateSize()
		local torsoPart = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso") -- Adapt for R6 or R15
		if torsoPart then
			textLabel.Text = "Torso Size: " .. string.format("%.2f, %.2f, %.2f", torsoPart.Size.X, torsoPart.Size.Y, torsoPart.Size.Z)
		else
			textLabel.Text = "Torso Size: N/A"
		end
	end

	-- Initial update and connect for future updates
	updateSize()

	-- Connect changes to the size of the torso
	local torsoPart = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
	if torsoPart then
		torsoPart:GetPropertyChangedSignal("Size"):Connect(updateSize)
	end

	-- Handle character respawning and remove the GUI
	player.CharacterRemoving:Connect(function()
		billboardGui:Destroy() -- Clean up the GUI when the character is removed
	end)
end)

end)

3 Likes

Sorry i forgot to post the code

– Place this script in a Script inside ServerScriptService

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoidRootPart = character:WaitForChild(“HumanoidRootPart”)

	-- Create the BillboardGui
	local billboardGui = Instance.new("BillboardGui")
	billboardGui.Name = "BillboardGui"
	billboardGui.Size = UDim2.new(0, 200, 0, 50) -- Adjust size as needed
	billboardGui.StudsOffset = Vector3.new(0, 5, 0) -- Position above the player
	billboardGui.AlwaysOnTop = true
	billboardGui.Parent = humanoidRootPart

	-- Create the TextLabel
	local textLabel = Instance.new("TextLabel")
	textLabel.Name = "TextLabel"
	textLabel.Size = UDim2.new(1, 0, 1, 0)
	textLabel.BackgroundTransparency = 1
	textLabel.TextColor3 = Color3.new(1, 1, 1) -- Set text color
	textLabel.TextStrokeTransparency = 0.5
	textLabel.TextScaled = true -- Ensure text scales properly
	textLabel.Text = "" -- Initialize with an empty string
	textLabel.Parent = billboardGui

	-- Function to update the TextLabel with the torso size
	local function updateSize()
		local torsoPart = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso") -- Adapt for R6 or R15
		if torsoPart then
			textLabel.Text = "Torso Size: " .. string.format("%.2f, %.2f, %.2f", torsoPart.Size.X, torsoPart.Size.Y, torsoPart.Size.Z)
		else
			textLabel.Text = "Torso Size: N/A"
		end
	end

	-- Initial update and connect for future updates
	updateSize()

	-- Connect changes to the size of the torso
	local torsoPart = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
	if torsoPart then
		torsoPart:GetPropertyChangedSignal("Size"):Connect(updateSize)
	end

	-- Handle character respawning and remove the GUI
	player.CharacterRemoving:Connect(function()
		billboardGui:Destroy() -- Clean up the GUI when the character is removed
	end)
end)

end)

.

3 Likes

the billboard GUI is inside the torso of the player, and the player is startercharacter.

1 Like

I dont see anything wrong with the code. Are there any errors?

1 Like

Yes the code doesn’t have any problem, but idk what should i do (there’s no errors)

1 Like

put prints in your code to make sure things actually run.
Second question, when you took these screenshots:

Were you still using a local script? If so then test again but ONLY with the server script.

5 Likes

the serverscriptservice with script instead of local script is the same as the images.

2 Likes

Ok then uh, you have some of the weirdest scripts ever, cause they should update on all clients. You are 100% sure that this is the case? (PLEASE DOUBLE CHECK). If so do you have any local scripts that would be changing the text? If so delete them.

3 Likes

i made sure for anything but honestly i’m not really good with scripts, so i need ur help to check my game because this bug will destroy my game…

2 Likes

Quick question, when you tested this, did you just playtest, or did you publish the game and play the published version?

1 Like