i set up attributes for plots when players join the game, i just want to connect it up to the plot sign as well but im kinda stuck for ideas atm. ty!
this is what i want, the players display name on the sign:
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
print("plot has been given to "..player.Name.."!")
break
end
end
1 Like
When a plot is assigned send the plot info with a remote event to all clients then using that you can update the sign on the client side
1 Like
i sent the info to the clients, i have the signID in each sign with a designated number 1-6 however sometimes the sign would say “[Player Name]'s Plot” instead of “Your plot” for the player that owns it and idk what i’m doing tbh.
i added this to the bottom of the server side:
-- 🔹 Fire RemoteEvent to update client-side signs
PlotAssigned:FireAllClients({
playerUserId = player.UserId,
displayName = player.DisplayName,
plotName = plot.Name,
SignID = PlotSignID,
})
and client side:
PlotAssigned.OnClientEvent:Connect(function(plotData)
if plotData and plotData.playerUserId == player.UserId then
-- Only update if it's YOUR plot that got assigned
BillboardManager:UpdateClientPlotName()
end
end)
function BillboardManager:UpdateClientPlotName()
for _, plot in ipairs(plots:GetChildren()) do
local ownerId = plot:GetAttribute("owner")
if not ownerId then continue end
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
local plotSignID = plot:GetAttribute("SignID")
for _, sign in ipairs(PlotSigns:GetChildren()) do
if sign:GetAttribute("SignID") == plotSignID then
local label = sign:FindFirstChild("TextLabel", true)
if label then
if ownerId == player.UserId then
label.Text = "Your Plot"
end
end
end
end
end
end