Hello, I am working on a tycoon game and slowly i am figuring out how the scripts work. I'm trying to get the player to teleport to their base once it is loaded in. the map i have has 9 locations that are in Workspace.properties
Each property model has an objectvalue called owner and base.
Workspace >
Properties>
Property>
Owner
Base
Property>
Owner
Base
Property>
Owner
Base
Property>
Owner
Base
Property>
Owner
Base
I know the property selection is working and when testing, the game updated the Owner object value with player1 or whatever my character name is.
For moving the player to the Base i have what is below. This is followed from models in the studio and things i have read. As you can imagine it does not work.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
for _, property in pairs(workspace.Properties:GetChildren()) do
if property:FindFirstChild("base") and property.Owner.Value == player
character:MoveTo(property.base.Position + Vector3.new(0, 20, 0))

1 comment
Didn't work. Not sure if i'm maybe putting it in the wrong place