Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make this GUI appear to a certain person whenever he respawns?

I'm trying to use this to make a GUI appear every time a certain player respawns, but it doesn't work for some reason.

local Players = game:GetService("Players")

local function onCharacterAdded(character)
	if character.Name == "Mexual" then
		game.Players.Mexual.PlayerGui:WaitForChild("OpEn").Frame.Visible = true
	else
		character.PlayerGui:WaitForChild("OpEn").Frame.Visible = false
	end
end

1 comment

0

Give us some context of what are you trying to do and how would this work.

3 answers

im just going to put what the script i used in my game but here is the script

while true do
 if game.Players.LocalPlayer.Name == "Mexual" then
	wait()
 else
  script.Parent:Destroy()
 end
end

the while true do makes it so its always looking for the player

remember to put the local script in the startergui

You could just this inside a LocalScript inside of the ScreenGui

local Player = game.Players.LocalPlayer
-- returns true or false
local IsAdmin = Player.Name:lower() == 'mexual' 
local ScreenGui = script.Parent
local Open = ScreenGui:WaitForChild('OpEn')
local Frame = Open:WaitForChild('Frame')

Frame.Visible = IsAdmin

You need to insert the following:

local gui = script.Parent

gui.ResetOnSpawn = false

if gui.Parent.Name == "PlayersName" then
    gui.TextLabel_orFrame_orScrollingFrame.Visible = true
else gui.TextLabel_orFrame_orScrollingFrame.Visible = false
end

Insert that into a LocalScript. (maybe script idk) But insert this into StarterGui in the game explorer

This discussion is preserved as it was. New answers, comments, and votes are closed.