Trying to change sign name for client that owns a plot

i set the sign names to [Player Name]'s Plot on the server but i’m trying to change it to Your Plot on the client for the person that owns the plot. i have no idea how to do it and i can’t find any resources on it unfortunately.

i have signID attributes in both the plot and the sign to distinguish what plot owns what sign:


server side:

function PlotManager:GivePlot(player : Player)
	for _, plot in plots:GetChildren() do
		if plot:GetAttribute("taken") then continue end
		plot:SetAttribute("taken", true)
		plot:SetAttribute("owner", player.UserId)
		
		local newPlotTag = PlotTag:Clone()
		newPlotTag.Parent = plot
		local frame = newPlotTag:FindFirstChild("Frame")
		local name = frame:FindFirstChild("name")
		local stroke = frame:FindFirstChild("stroke")
		local avatarImage = frame.avatarImage
		local image = nil
		
		name.Text = player.DisplayName
		stroke.Text = player.DisplayName
		
		--local hue = math.random()
		--print("hue: "..hue)
		--frame.BackgroundColor3 = Color3.fromHSV(hue, 1, 1)
		local success, errorMsg = pcall(function()
			image = players:GetUserThumbnailAsync(
				player.UserId,
				Enum.ThumbnailType.HeadShot,
				Enum.ThumbnailSize.Size100x100
			)
		end)

		if success then
			avatarImage.Image = image
		else
			warn("failed to get avatar image for "..player.Name, ": ", errorMsg)
		end
		
		local PlotSignID = plot:GetAttribute("SignID")

		for _, sign in ipairs(PlotSigns:GetChildren()) do
			if sign:GetAttribute("SignID") == PlotSignID then
				local SignText = sign:FindFirstChild("TextLabel", true)
				if SignText then
					SignText.Text = player.DisplayName.."'s Plot"
				end
				break
			end
		end
		
		-- 🔹 Fire RemoteEvent to update client-side signs
		PlotAssigned:FireAllClients({
			playerUserId = player.UserId,
			displayName = player.DisplayName,
			plotName = plot,
			SignID = PlotSignID,
		})
		print("plot has been given to "..player.Name.."!")
		break
	end
end

client side:

-- Define the function FIRST
function BillboardManager:UpdateClientPlotName()
	for _, plot in ipairs(plots:GetChildren()) do
		local ownerId = plot:GetAttribute("owner")
		local plotSignID = plot:GetAttribute("SignID")
		if not ownerId or not plotSignID then continue end

		-- Update BillboardGui name on plot
		local PlotTag = plot:FindFirstChild("PlotTag")
		if PlotTag and PlotTag:IsA("BillboardGui") then
			local frame = PlotTag:FindFirstChild("Frame")
			local name = frame and frame:FindFirstChild("name")
			local stroke = frame and frame:FindFirstChild("stroke")

			if ownerId == player.UserId then
				if name then name.Text = "Your Plot" end
				if stroke then stroke.Text = "Your Plot" end
			end
		end

		for _, sign in ipairs(PlotSigns:GetChildren()) do
			if sign:GetAttribute("SignID") == plotSignID then
				local surfaceGui = sign:FindFirstChild("SurfaceGui")
				local SignText = surfaceGui and surfaceGui:FindFirstChild("TextLabel")
				if SignText then
						SignText.Text = "Your Plot"
				end
				break
			end
		end
	end
end

PlotAssigned.OnClientEvent:Connect(function(plotData)
	if plotData and plotData.playerUserId == player.UserId then
		-- Only update if it's YOUR plot that got assigned
		print(plotData)
		BillboardManager:UpdateClientPlotName()
	end
end)

You should connect the plot being claimed to a remote event. When the plot is claimed, fire it from the server script to the client, then get the plotSign and change it. (Make sure u’re changing it in a localscript)

1 Like

i fired the remote from the server to the client but there’s something wrong with my logic for changing the text and it’s not changing:

		for _, sign in ipairs(PlotSigns:GetChildren()) do
			if sign:GetAttribute("SignID") == plotSignID then
				local surfaceGui = sign:FindFirstChild("SurfaceGui")
				local SignText = surfaceGui and surfaceGui:FindFirstChild("TextLabel")
				if SignText then
					SignText.Text = "Your Plot"
				end
				break
			end
		end

Try using pairs instead of ipairs? Just to test something, this might be the issue.

Also i’m roblox is not capable of getting a value from an attribute and translating it (atleast that was the reasoning behind an issue i was having), so that might be the issue and you might want to change your way of way of checking for the player’s plotSignID.

1 Like

yeah i tried pairs and unfortunately it’s not working. i tried adding debugging statements too. when i do a local server test with 2 players it doesnt work and i get `“SignModel not found in plot”. it works solo tho :triumph:

this is what i tried

function BillboardManager:UpdateClientPlotName()
	for _, plot in pairs(plots:GetChildren()) do
		local ownerId = plot:GetAttribute("owner")
		
		-- Update BillboardGui name on plot
		if ownerId and ownerId == player.UserId then
			--print(type(ownerId))
			local PlotTag = plot:FindFirstChild("PlotTag")
			if PlotTag and PlotTag:IsA("BillboardGui") then
				local frame = PlotTag:FindFirstChild("Frame")
				local name = frame and frame:FindFirstChild("name")
				local stroke = frame and frame:FindFirstChild("stroke")

				if name then name.Text = "Your Plot" end
				if stroke then stroke.Text = "Your Plot" end
			end

			local SignModel = plot:FindFirstChild("SignModel")
			print("SignModel found:", SignModel)

			if SignModel then
				local Sign = SignModel:FindFirstChild("Sign")
				print("Sign found:", Sign)

				if Sign then
					-- Try to find any SurfaceGui within the Sign (don't assume the name)
					local SurfaceGui = Sign:FindFirstChildOfClass("SurfaceGui")
					print("SurfaceGui found:", SurfaceGui)

					if SurfaceGui then
						local SignText = SurfaceGui:FindFirstChild("TextLabel")
						print("SignText found:", SignText)

						if SignText then
							print("Setting SignText.Text to 'Your Plot'")
							SignText.Text = "Your Plot"
						else
							warn("TextLabel not found in SurfaceGui")
						end
					else
						warn("SurfaceGui not found in Sign")
					end
				else
					warn("Sign not found in SignModel")
				end
			else
				warn("SignModel not found in plot")
			end
		end
	end
end

I’m pretty sure that it’s just that roblox cannot compare the attrbitute’s value then and that’s why it’s not working, so you’re probably gonna have to switch to a direct value instead

1 Like

When testing 2 player, look on the clients explore tab and see if there is a SignModel under the Plots

i found the problem. my script was running before objects were loading so a simple wait statement fixed it. :man_facepalming:

PlotAssigned.OnClientEvent:Connect(function()
	task.wait(0.5)
	print("PlotAssigned event received on client")
	BillboardManager:UpdateClientPlotName()
end)