Ive tried this script but it doesn't seem to work:
script.Parent.MouseButton1Down:Connect(function()
game.StarterGui.PurchaseGUI.Frame=true
end
Ive tried this script but it doesn't seem to work:
script.Parent.MouseButton1Down:Connect(function()
game.StarterGui.PurchaseGUI.Frame=true
end
Make sure this is in a local script in StarterGui, and that you replace the variable.
local part = game.Workspace.Part -- Your part here
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
part.ClickDetector.MouseClick:Connect(function()
playerGui.PurchaseGUI.Enabled = true
end)
The PlayerGui is what the players see, so you need to put that there to enable it for a certain player.
ClickDetector use MouseClick Event, and you could use the parameter:
script.Parent.ClickDetector.MouseClick:Connect(function(PlayerWhoClickedNotCharacter)
PlayerWhoClickedNotCharacter.PlayerGui.PurchaseGUI.Enabled = true
end)
Also i don't understand what u mean by .PurchaseGUI.Frame, so i changed it to .PurchaseGUI.Enabled
I don't believe ClickDetectors use any parameters, but okay.
Yes it does
Apologies, I was told otherwise by someone else.
It's ok, you learn something new everyday
This discussion is preserved as it was. New answers, comments, and votes are closed.
9 comments
You also need to make sure that the part you want to click to open it has a ClickDetector.
When I press the button the GUI Doesn't pop up and i get this response: PurcahseGUI is not a valid member of PlayerGui
What's the ScreenGui's name?
PurchaseGUI
Edited. Should work now.
Just tested it and it works now! Thanks!
No problem! Please accept my answer.
sorry, im new to this, how do i do that?
Hover over my answer and there should be a thing that says 'accept answer'. Sorry for late reply, my wifi went down for like 2 minutes.