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

Teleporting Script doesn't work, yet the Output says 'It isn't a valid member' even though it is?

local player = game.Players.LocalPlayer
local char = player.Character

game.Workspace.Tardis.Door.Knob.ClickDetector.MouseClick:connect(function()
	for i = 1,0,-0.1 do
		player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = i
		player.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = i
		wait()
	end
	wait(1)
	char.HumanoidRootPart.CFrame = game.Workspace.TargetBlock.CFrame + Vector3.new(0,3,0)
	wait(1)
	for i = 0,1,0.1 do
		player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = i
		player.PlayerGui.ScreenGui.Frame.TextLabel.TextTransparency = i
		wait()
	end
end)

The game itself has 'Filtering Enabled'. The script also works before, but now it doesn't work. I tried going to the output, but it suggested that, "Knob isn't a valid member of the model." It's weird because it's the actual name of the object yet it won't do the script. Is there something missing that I'm not aware of?

2 comments

0

use a if-nil comparator statement

0

If this is a local script, then you should be using :WaitForChild(). Because player scripts load in before anything else, the script will search for "Knob" before it has loaded in.

1 answer

First, try using workspace alone. It's better also take a look at :MoveTo(), it's a better CFrame based teleportation method. Sometimes a Script can run faster than the Assets can load, try adding a delay or saying workspace.Tardis.Door:WaitForChild("Knob") to see if it rests at " "infinite yield possible", therefore It's best to take a harder look at why it's not recognizing it, maybe look at your spelling too

1 comment

0

Okay. I made a variable with the same directory, except I added the WaitForChild function in the "Knob" you mentioned, since the other comment said this is for LocalScripts. It suppressed the 'member error', but the 'Infinite yield possible' error came in. What do I do?

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