So I put this script in a click detector that was in a brick but it doesn't work. I want the brick when clicked to show text.
function Clicked(Plr) Plr.PlayerGui.Gui.Frame.Visible=true end
script.Parent.MouseClick:connect(Clicked)
Should I rename theScreenGui to PlayerGui to fix it?
You don't need to rename StarterGui to PlayerGui. Roblox automatically does that when the StarterGui is in a player.
You need to use :GetPlayerFromCharacter()
. Here is how you would use it in your script.
script.Parent.MouseClick:connect(function(Clicked) --This basically activates the function when the thing is clicked. game.Players:GetPlayerFromCharacter(Clicked).PlayerGui.Gui.Frame.Visible = true end)
In the parenthesis of :GetPlayerFromCharacter()
, you need the player in the Workspace. Like :GetPlayerFromCharacter(workspace.Player1)
. Also, you should use :GetPlayerFromCharacter()
after the player property like game.Players:GetPlayerFromCharacter()
.
PlayerGui is a main thing for stuff like this. It pops up only for a specific players GUI. I would do this script below.
INSTRUCTIONS! 1). Make sure this script is a script and that it is in the brick with a ClickDetector 2). Change {GUINAME} to whatever GUI you want to open 3). Change FRAMENAME to the frame inside whatever your GUI you want to open is called! 4). You could also edit inside the frame!
script.Parent.ClickDetector.MouseClick:Connect(function(onClick) game.Players.LocalPlayer.GUINAME.FRAMENAME.Visible = true end)
What does this script mean? 1). game.Players.LocalPlayer goes into the games section {Players} and finds the LocalPlayer clicking the button.
IF YOU NEED ANY FURTHER HELP PLEASE MESSAGE BACK TO THIS. I AM A BEGINNER SCRIPTER AND I HAVE A STRONG PASSION FOR IT SO I AM NOT PERFECT, BUT I AM OKAY WITH GUIS AND EDITING PART'S PROPERTIES AND MAKING MODELS APPEAR AND DISAPPEARING.
Hope this helped, -Goldenkings11
You need to use this script:
script.Parent.ClickDetector.MouseClick:Connect(function(onClick) game.Players.LocalPlayer.PlayerGui.YourGuiNameHere.YourFrameNameHere.Visible = true end)
Remember, the script and clickdetector MUST be in the part you want to be clickable!
put this in a locascript in startergui
game.Workspace.Part.ClickDetector.MouseClick:connect(function() --change part to part name script.Parent.ScreenGui.TextLabel.Visible = true --change screengui and textlabel to the frame you want to be visible