Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Mexual 2
4 years ago

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
0
Give us some context of what are you trying to do and how would this work. Chiken983 15 — 4y

3 answers

Log in to vote
0
Answered by
3wdo 198
4 years ago
Edited 4 years ago

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

Ad
Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Answer this question