Iv'e been working on creating a system for my game where each player is assigned a unique plot ID And they can build on that plot. When a player joins they get a plot ID that corresponds with an Id Of one of the plots in the game. For the building, I have a local script that contains variables for retrieving the players plot ID and the selected block ID:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local pid = player.plotID.Value
local partid = player.buildID.Value
Now when I clone The part to the players plot I use the following code:
mouse.Button1Down:connect(function(click)
if mouse.Target.Name == "plot" then
if mouse.Target.id.Value == player.plotID.Value then
local a = game.Lighting.Blocks.partid:Clone()
a.Parent = game.Workspace.pid
a.Position = Vector3.new(round(mouse.Hit.p.x), 1.5, round(mouse.Hit.p.z))
end
end
end)
I get the following error: pid is not a valid member of workspace, but I dont want it to look for pid in the workspace, I want it to look for game.workspace.(Player plot ID). How can I use the variable "pid" in the game path ? Thanks for your help.

1 comment
use :FindFIrstChild(tostring(pid))