local players = game:GetService("Players")
local Owner = script.Parent.Owner
players.PlayerAdded:Connect(function(player)
if Owner.Value == nil then
Owner.Value = player.Name
else
end
end)
My issue: I am trying to create an owner script for plots using a StringValue inside of the Plots folder, my issue is the value of “Owner” is not changing to the players name whenever they join the game.
Try to put the script in ServerScriptService and try this code.
game.Players.PlayerAdded:Connect(function(player)
for _,ownervalue in pairs(workspace.Plots:GetChildren()) do
if ownervalue.Owner.Value == “” then
ownervalue.Owner.Value = player.Name
break
end
end
end)