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

Character is not a valid member of PlayerGui?

Can you guys help me fix this?

function Click()
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(133.456, 16.226, 41.188) 
end

script.Parent.MouseButton1Down:connect(Click)

if needed, this is where the TextButton I try to click so I can be teleported to is.

StarterGui OpenCloseGUI Frame TextButton

1 answer

✓ Accepted answer

I think you forgot to add one more .Parent to line 2, so it might look like this

function Click()
script.Parent.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(133.456, 16.226, 41.188) 
end

script.Parent.MouseButton1Down:connect(Click)

4 comments

0

Awesome! That was exactly what I was missing. Thanks a lot really appreciate it.

0

happy to help!

0

jediploccon how did you spot that mistake?

0

Since the error was "Character is not a valid member of PlayerGui" that means that the code was trying to reference the folder 'PlayerGui' which is one of this child's of the player, so if you just add one more .Parent in the script it should reference the player correctly

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