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

Character is not a valid member of PlayerGui?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
Awesome! That was exactly what I was missing. Thanks a lot really appreciate it. ItsJZaid 45 — 4y
0
happy to help! jediplocoon 877 — 4y
0
jediploccon how did you spot that mistake? JesseSong 3916 — 4y
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 jediplocoon 877 — 4y
Ad

Answer this question