Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Teleport Part is not a valid member of workspace ?

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

✓ Accepted answer

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

local target = script.Parent.ModelName.TeleportPart

4 comments

0

k thanks i will try that

0

Thanks it worked

0

i am still stumped that it worked without me putting model name in it and now it didnt.

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.