I have seen other post like this but they are still not working for me.
So i am trying to make a “note system” . There is a piece of paper of a table and when you click on it a gui appears
This issue is that nothing is popping up
This is the code
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function()
game.StarterGui.ScreenGui.Frame.Visible = true
end)
I’ve seen from other topics that i will have to change the player gui then i tried this
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
end)
But this is the error i’m getting:
I’m new to scripting so sorry if there is a super simple awnser.
Thanks for reading.
Tracccck
(NotTrack)
May 13, 2020, 10:39am
#2
I Think that you should add some :WaitForChild() functions.
Is this a local script? (To little characters)
No just a regular script, should it be a local one?
yes, the script does’t know what a local player is in a normal script, instead do this:
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function(plr)
plr.PlayerGui.ScreenGui.Frame.Visible = true
end)
1 Like
Tracccck
(NotTrack)
May 13, 2020, 10:42am
#8
Hold on, you can only do local player on local script.
If you want to get it using a button, use the one that @DevParallax taught
Did you put it in a local script? Cause the script I showed you needs to be in a normal script.
If not, what’s the error.
Oh okay let me try to put it in a normal script.
GUI stuff must ALL be done in a LocalScript
Its bad practice to manipulate Guis on Server Scripts for reasons
Latency
Unecessary Network Traffic
If you want to make a shop Gui then you need to use both
LocalScript:
ServerScript:
Checking if the player has enough money*
Giving the player whatever he/she purchased
*This is to obey “Basic Side Validation”
The communication from Client <-> Server can be done using Remotes
2 Likes
No worries, next time don’t get your local and server scripts mixed up local scripts only apply to the local player, for example StarterGui, Character, ect… If you want it to apply to everyone then use a server script.
There are some exemptions for this but that’s beyond your standard at the moment, no offence, just don’t want to confuse you.
1 Like