OK, im new to this ( I think that is why people are always giving me - score LoL)
I am making a Free-Build map.
I have all the script for it and the map built.
I am adding some twist, I added turrets, towers, and upgrades.( all that can be bought with cash from kills)
I have the script that gives all 9 players their area to work in to free build.
I can not figure out how to add all of my upgrade so that they ( and only them) can buy them and use them.
here is the script that gives the players their ownership.
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(game, "Workspace")
waitForChild(game.Workspace, "BuildingPlates")
waitForChild(game, "Players")
local activeParts
if(game.Workspace:FindFirstChild("ActiveParts")==nil) then
activeParts = Instance.new("Model")
activeParts.Name = "ActiveParts"
activeParts.Parent = game.Workspace
else
activeParts = game.Workspace.ActiveParts
end
local buildingPlates = game.Workspace.BuildingPlates
local assigning = false
function addPlayer(player)
print("addPlayer()", "waiting for previous addPlayer...")
while(assigning) do
assigning.Changed:wait()
end
assigning = true
print("addPlayer()", "waiting for playerNumber...")
waitForChild(player, "playerNumber")
print("addPlayer()", "assigning...")
if(player.playerNumber.Value == 0) then
-- This is an extra player. He has playerNumber 0, and spawns in a different spawn point on the side.
-- He doesn't get a stamper tool.
print("addPlayer() playerNumber:", player.playerNumber, "stamperTool name:", player.Backpack.StamperTool.Name, "Removing stamperTool.")
-- hint("All building areas are taken. If you want to build, leave and join again.")
--waitForChild(player.Backpack, "StamperTool")
--player.Backpack.StamperTool:Remove()
--[[
game.Workspace.Message.Text = player.Name .. " joined, and has playerNumber " .. player.playerNumber.Value .. " and doesn't own a baseplate."
wait(3)
game.Workspace.Message.Text = ""
--]]
else
-- He has his own plate. Get him set up.
-- Give him a model for all his parts
if(activeParts:FindFirstChild(player.Name .. "'s parts")==nil) then
local model = Instance.new("Model")
model.Name = player.Name .. "'s parts"
model.Parent = activeParts
end
-- Assign plate
print("assignPlate() playerNumber not zero:", player.playerNumber.Value)
waitForChild(buildingPlates, "Plate"..tostring(player.playerNumber.Value))
targetPlate = buildingPlates:FindFirstChild("Plate"..tostring(player.playerNumber.Value))
-- Create "Player" StringValue inside targetPlate if none exists (for some reason, it gets deleted sometimes when playing online.)
if(targetPlate:FindFirstChild("Player") == nil) then
local _player = Instance.new("StringValue")
_player.Name = "Player"
_player.Parent = targetPlate
end
targetPlate.Player.Value = player.Name
print("assignPlate()", "complete.", targetPlate.Name, "belongs to", player.Name)
--[[
game.Workspace.Message.Text = player.Name .. " joined, and has playerNumber " .. player.playerNumber.Value .. " and owns baseplate " .. targetPlate.Name .. "."
wait(3)
game.Workspace.Message.Text = ""
--]]
end
assigning = false
end
function removePlayer(player)
-- Delete his model
waitForChild(game.Workspace, "ActiveParts")
waitForChild(game.Workspace.ActiveParts, player.Name .. "'s parts")
local model = game.Workspace.ActiveParts:FindFirstChild(player.Name .. "'s parts")
model:remove()
-- Free his plate
local takenPlates = buildingPlates:GetChildren()
for i = 1, #takenPlates do
if takenPlates[i].Player.Value == player.Name then
takenPlates[i].Player.Value = ""
end
end
end
-- In case we already have players by the time this script initializes
local players = game.Players:GetChildren()
for i = 1, #players do
addPlayer(players[i])
end
game.Players.PlayerAdded:connect(function(player)
addPlayer(player)
end)
game.Players.PlayerRemoving:connect(function(player)
removePlayer(player)
end)
can someone help me please?

4 comments
To make only the own use it, make a check for the player. Possible make a StringValue when someone gains ownership, then have the script check that variable's value and players name, if it matches, continue with code, if not, don't.
Can you explain what you mean by: "I can not figure out how to add all of my upgrade so that they ( and only them) can buy them and use them."
Well, i have 9 pads , one for each player were they can build anything. but on the outside i made some stuff, like walls, turrets towers, and upgrades. i want them to be able to buy them with cash. but i dont want other players able to buy them, or use them.. so its kind of a freebuild/military/tycoon
The cash is made from killing other players.