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 ScreenGui??

Asked by 4 years ago
Edited 4 years ago

So i'm trying to make this morph GUI but everytime i fix an error i get a new one and im really stumped, what am i doing wrong?

Player = script.Parent.Parent.Parent
Me = Player.Character or Player.CharacterAdded:wait()
local Morphs = script.Parent.Morphy:GetChildren()
script.Parent.MouseButton1Click:connect(function(r)
0
Please include what type of script it is and where it is located. Spjureeedd 385 — 4y
0
It's a Local Script and its located in a GUI in a Frame and in an Image Button HannahToots 4 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

If you're running in a localscript, which you should be if it's a child of a Gui, you can use game.Players.LocalPlayer I would recommend you use a localscript under the Gui which fires a remote whenever you need server access.

Ad
Log in to vote
0
Answered by 4 years ago

You forgot the "local" before Player and Me. Here's the fixed script.

local Player = script.Parent.Parent.Parent
local Me = Player.Character or Player.CharacterAdded:wait()
local Morphs = script.Parent.Morphy:GetChildren()
script.Parent.MouseButton1Click:connect(function(r)

Please reply if it worked and mark it as the answer.

Thanks.

0
Nope still doesn't work. HannahToots 4 — 4y
0
Wouldn't make any difference except for making the variables local robloxianmirror 57 — 4y
0
Anything printing in the client? (Press F9, check if anything is there) CheeseRespect2019 -2 — 4y
0
It's just saying " Character is not a valid member of ScreenGui" and "Script 'Workspace.Part.CostumeGui.Frame.1.Script', Line 5" which is the line that is having the issue. HannahToots 4 — 4y

Answer this question