Hello I just recently received error code 22:31:46.622 how do I fix it? Can anyone help me?
It was about MouseButton1Click on a text button.
Do you know what the actual error is? What’s the output showing.
The error is MouseButton1Click is not a valid member of screenGUI, thats what the output says.
Can you show your code?
ok Here is my code its very short and simple.
game.StarterGui.PurchaseCash.MouseButton1Click:connect(function(hit)
script.Parent.Frame.Visible = true
end)
Why do you have hit by the function? Is PurchaseCash a button?
Also you need to address it to PlayerGui not starterGui
You are trying to click a ScreenGui
which is not possible. Make a TextButton
inside that gui.
Once you do what @FlashFlame_Roblox said you can do:
Your fixed code:
game.Players.LocalPlayer.PlayerGui.ScreenGUI.PurchaseCash.MouseButton1Click:connect(function(hit)
--ScreenGui being the ScreenGui you will insert.
script.Parent.Frame.Visible = true
end)
Um you might want to fix game.Players.LocalPlayer.ScreenGUI.PurchaseCash
to game.Players.LocalPlayer.PlayerGui.ScreenGUI.PurchaseCash
oops forgot to add that
I did all of that and it says screenGUI is not a valid member of PlayerGUI
What’s the name of the ScreenGUI you inserted?
The name of the screenGUI I inserted is PurchaseCash.
The you would put
game.Players.LocalPlayer.PlayerGui.PurchaseCash.PurchaseCash.MouseButton1Click:connect(function(hit)
--ScreenGui being the ScreenGui you will insert.
script.Parent.Frame.Visible = true
end)
Assuming it’s the same names as before.
It says PurchaseCash is not a valid member of purchaseCash and when I deleted the second purchaseCash it said MouseButton1Click is not a valid member of screenGUI.
Oh so the name is purchaseCash ?
No in that reply I made a mistake and said purchaseCash but its still PurchaseCash with a capital P
Your script would be:
game.Players.LocalPlayer.PlayerGui.purchaseCash.PurchaseCash.MouseButton1Click:connect(function(hit)
--ScreenGui being the ScreenGui you will insert.
script.Parent.Frame.Visible = true
end)
When you are coding, variables’ names are important. Make sure when you want to reference something, type the names correctly.