So a person named "Ziffix" scripted me this script were only certain players listed in the table can view the Gui. The problem is that the people that have permission to view the Gui, when they die the Gui disappears and they need to rejoin for it to appear once again which will be annoying. Can someone help me and make it so it's there forever for the people who have permission to view the Gui?
Here is the script:
local Players = game:GetService("Players") local AuthorizedUsers = {[525025404] = "Nitrolux200";} local GUI = script.HostOnlyGui Players.PlayerAdded:Connect(function(Player) if (AuthorizedUsers[Player.UserId]) then --------------- GUI:Clone().Parent = Player.PlayerGui end end)
you see, the gui clones and adds in each time player joins the game, but you said the issue was that if the player joins the game and resets, the gui won’t reclone. This is when you need to use characteradded. This event fires when player’s character spawns or respawn (https://developer.roblox.com/en-us/api-reference/event/Player/CharacterAdded)
so what you need to do is,
local Players = game:GetService("Players") local AuthorizedUsers = {[525025404] = "Nitrolux200";} local GUI = script.HostOnlyGui Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) if (AuthorizedUsers[Player.UserId]) then --------------- GUI:Clone().Parent = Player.PlayerGui end) end end)
If there’s anything wrong. Tell me, because I’m on mobile right now