Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a move character script, but it isn't working. How can i make this work?

Asked by 4 years ago

Hi there. I am trying to create a plot system, and when the game starts it teleports the player to their plot. Here is my local script which i put in Starter PLayer Scripts:

local player = game.Players.LocalPlayer

local function MoveChar(Char, X, Z)
    wait(0.1)

    Char:SetPrimaryPartCFrame(CFrame.new(X, 3, Z))
end

player.CharacterAdded:Connect(function(char)
    for i, plt in pairs(workspace.Plots:GetChildren()) do
        if plt then
            if plt.Plot.Owner.Value == player.Name then
                MoveChar(char, plt.Plot.Spawn.CFrame.X, plt.Plot.Spawn.CFrame.Z)

                break
            end
        end
    end
end)

The error i am getting is that spawn is not a valid member of Part. Generally, i think that would mean i placed the spawn block in the wrong space. But these are my placements. P.S: All blocks are anchored

In workspace: Folder Plots. Model: Plot1 Part: Plot Value: Owner Part: Spawn

Is that confusing?

Apreciate any help!!! Thanks.

0
Is the 'Spawn' part a child of Plot? appxritixn 2235 — 4y
0
yes Superexperiencedguy 199 — 4y

Answer this question