I have the admin give script to give admin commands to specific people. However, the script only seems to work only once when the player spawns, and will never work after that when they die. I tried it in new place without any other script than this script but still doesnt work, and also won
t create any error.
local admins = {-1,-2,-3,-4,-5,-6} local overHeadGui = game:GetService("ServerStorage").adminGUI:WaitForChild("adminLabel") local admin = game:GetService("ServerStorage"):WaitForChild("adminGUI") local owner = admin:WaitForChild("ownerCommands") local staff = admin:WaitForChild("adminCommands") game.Players.PlayerAdded:Connect(function(player) print("Player Joined") player.CharacterAdded:Connect(function(character) print("Respawn Detected") for i, v in pairs (admins) do if player.UserId == v then print("admin is valid") if i == 1 then print("owner detected") print("the admin label is not valid yet") local cloneGUI = overHeadGui:Clone() cloneGUI.TextLabel.Text = "Owner" cloneGUI.TextLabel.TextColor3 = Color3.fromRGB(150,138,189) cloneGUI.TextLabel.Size = UDim2.new(0,100,0,50) cloneGUI.Parent = character:WaitForChild("Head") print("setted admin label") local cloneAdmin = owner:Clone() print(cloneAdmin.Name) local adminGuiPlaceHold = player.PlayerGui:WaitForChild("adminGui") cloneAdmin.Parent = adminGuiPlaceHold for i,v in pairs(player.PlayerGui.adminGui:GetChildren()) do print(v.Name) wait() end print("clone admin setted. Parent") -- for i,v in pairs (character:GetChildren()) do -- if v:IsA("BasePart") and v.Name ~="HumanoidRootPart" and v.Name ~= "Head" then -- print("making it transparent") -- v.Transparency = .5 -- v.Material = Enum.Material.Neon ---- if v.Name == "Head" then ---- v.Size = Vector3.new(.5,.5,.5) ---- elseif v.Name == "Torso" then ---- v.Size = Vector3.new(2,2,.5) ---- elseif v.Name == "LeftArm" or "RightArm" then ---- v.Size = Vector3.new(1,5,1) ---- end -- end -- if v.Name == "Head" then -- print("head transparent = 1") -- v.Transparency = 1 -- for _,child in pairs(v:GetChildren()) do -- if child.Name == "face" then -- print("face destroyed") -- child:Destroy() -- end -- end -- end -- end print("everything for owner done.") elseif i == 4 then -- for i,v in pairs (character:GetChildren()) do -- if v:IsA("BasePart") and v.Name ~="HumanoidRootPart" then -- v.Transparency = .5 -- v.Material = Enum.Material.Neon ---- if v.Name == "Head" then ---- v.Size = Vector3.new(.5,.5,.5) ---- elseif v.Name == "Torso" then ---- v.Size = Vector3.new(2,2,.5) ---- elseif v.Name == "LeftArm" or "RightArm" then ---- v.Size = Vector3.new(1,5,1) ---- end -- end -- end local cloneGUI = overHeadGui:Clone() cloneGUI.TextLabel.Text = "Co-Owner" cloneGUI.Parent = character:WaitForChild("Head") local cloneAdmin = staff:Clone() cloneAdmin.Parent = player.PlayerGui:WaitForChild("adminGui") else local cloneGUI = overHeadGui:Clone() cloneGUI.Parent = character:WaitForChild("Head") local cloneAdmin = staff:Clone() cloneAdmin.Parent = player.PlayerGui:WaitForChild("adminGui") end end end print("Every task done!") return end) print("out of char script") end)
--How I Solved-- I found that I had the speed respawn script that respawned my character before anything else loads up. When I added extra seconds, the script started to work properly.