Teleporting a player according to an object Value, not working?
I want to be able that, when a player clicks on a GUI (Build), they teleport to a part that has an ObjectValue
, in this case their username
Though, I always get the error: "attempt to index up Value 'Plot'" or "Infinite yield possible on WaitForChild["Plot.Value"]"
I am a beginner btw, here is my script:
01 | local Plot = game.Workspace.Plots:GetChildren() |
02 | local player = game.Players.LocalPlayer |
03 | local Location = game.Workspace.Plots:GetChildren() [ script.Parent:WaitForChild( "Plot.Value" ) ] |
04 | local Character = player.Character |
06 | script.Parent.MouseButton 1 Click:Connect( function () |
07 | for i,plt in pairs (workspace.Plots:GetChildren()) do |
09 | if plt.Plot.Owner.Value = = player then |
11 | Character:MoveTo(Location.Position) |
12 | game.Workspace.PlotBounds.Bound 1. CanCollide = true |
13 | game.Workspace.PlotBounds.Bound 2. CanCollide = true |
14 | game.Workspace.PlotBounds.Bound 4. CanCollide = true |
15 | game.Workspace.PlotBounds.Bound 5. CanCollide = true |
16 | script.Parent.Parent.Visible = false |
17 | script.Parent.Parent.Parent.ExitBuildMode.Visible = true |
18 | script.Parent.Parent.Parent.ExitBuildMode.TextLabel.Visible = true |