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

Teleport Part is not a valid member of workspace ?

Asked by 6 years ago

I have a Part named "Teleport Part" in my workspace. The reason for that part is to teleport to it when i press a button. But when i press the button it says Teleport Part is not a valid member of workspace. My part is in a model.

Just ignore the comments since i took this script from somewhere else but put my info in it. It used to work before but suddenly stopped.

Player = game.Players.LocalPlayer --Only works inside a localscript, replace with the line below it if you need it as a Script.
    -- Player=script.Parent while (not Player:IsA("Player")) do Player = Player.Parent end

    script.Parent.MouseButton1Up:connect(function()
        local index, Time
        for index, Time in pairs(Player.leaderstats:GetChildren()) do
            Time.Value = 0
local db = true
local player = game.Players.LocalPlayer
local target = game.Workspace.TeleportPart
local delay = 3
script.Parent.MouseButton1Click:connect(function()
    if db == true then
        db = false
        player.Character.HumanoidRootPart.CFrame = target.CFrame * CFrame.new(0, 3, 0)
        for i = delay, 1, -1 do
            script.Parent.Text = i
            wait(1)
        end
        script.Parent.Text = "Reset"
        db = true
    end
end)
        end
    end)

Any sort of help will be appricieated

1 answer

Log in to vote
0
Answered by
stepatron 103
6 years ago

If the part is in a model, you have to put that too. so it should be:

local target = script.Parent.ModelName.TeleportPart
0
k thanks i will try that stuntbros -3 — 6y
0
Thanks it worked stuntbros -3 — 6y
0
i am still stumped that it worked without me putting model name in it and now it didnt. stuntbros -3 — 6y
0
np stepatron 103 — 6y
Ad

Answer this question