#need help cant teleport to plot

1 messages · Page 1 of 1 (latest)

sand ingot
#

Idk why this script dose not teleport me to the plot that i made

#

need help cant teleport to plot

wicked crest
#

Blud think we know the plot handler script

exotic birch
#

we'd have to see the plotHandler module

#

but it could also be that the function youre calling is misspelled

#

"telepotToPlot"

#

idk how its spelled in the script

#

so i cant say for sure

#

but it should be spelled correctly if not

worthy ocean
#

not even the error msgs is crazy 💔

storm path
#

🥀

sand ingot
#

here is the plothadler script

#

local PlotHandler = {}

PlotHandler.AvaliablePlots = game.Workspace.Plots:GetChildren()

function PlotHandler.GetPlot(player)
for _, plot in pairs(game.Workspace.Plots:GetChildren()) do
local ownerValue = plot:FindFirstChild('Owner')

    if ownerValue and ownerValue.Value == player then
        return plot
    end
end

end

function PlotHandler.TelepotToPlot(player)
local character = player.Character
local plot = PlotHandler.GetPlot(player)

if character and plot then
    character:MoveTo(plot:FindFirstChild('Teleport Part').Position)
end

end

local function updatePlotUI(plot, text)
local ownerSign = plot:FindFirstChild("OwnerSign")
local ownerLable = ownerSign.Sign.SurfaceGui.SIGN

ownerLable.Text = text

end

function PlotHandler.AssignPlot(player)
local playerPlot = PlotHandler.AvaliablePlots[math.random(1, #PlotHandler.AvaliablePlots)]
table.remove(PlotHandler.AvaliablePlots, table.find(PlotHandler.AvaliablePlots, playerPlot))

local ownerValue = playerPlot:FindFirstChild("Owner") or Instance.new("ObjectValue")
ownerValue.Name = 'Owner'
ownerValue.Parent = playerPlot
ownerValue.Value = player.Name

updatePlotUI(playerPlot, player.DisplayName)

end

function PlotHandler.UnassignPlot(player)
local plot = PlotHandler.GetPlot(player)

if plot then
    plot:FindFirstChild('Owner').Value = nil
    table.insert(PlotHandler.AvaliablePlots, plot)
    
    updatePlotUI(plot, 'Empty')
end

end

return PlotHandler