I edited an overhead cloning script and it works for a long time now but it suddenly stop working, what I try first was to Remove the script base on an error but it doesn' t work, so next I try to Donwdate the game using the version which work perfectly but it doesnt solve the problem.
The error message have something to do on the "Role" which I tried to delete but it doesn't work, I think it is cause by some update made by roblox.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local Overheads = ReplicatedStorage:WaitForChild("OverheadsGui") local GroupId = 11540689 ----// GROUP ID local Left = Overheads:WaitForChild("Left") local Right = Overheads:WaitForChild("Right") Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) -- These variables are used regardless of whether the user owns the gamepass or not -- so we can define them outside the if statement local Humanoid = Character:WaitForChild("Humanoid") local Head = Character:WaitForChild("Head") local Stats = Player:WaitForChild("playerstats").Rank.Value -- Again, this happens regardless of the if statement Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None if Stats == "Unrank" then Left.Image = "rbxassetid://11260847774" Right.Image = "rbxassetid://11260873360" elseif Stats == "Bronze" then Left.Image = "rbxassetid://11260880194" Right.Image = "rbxassetid://11260884454" elseif Stats == "Silver" then Left.Image = "rbxassetid://11260890595" Right.Image = "rbxassetid://11260895668" elseif Stats == "Gold" then Left.Image = "rbxassetid://11260902279" Right.Image = "rbxassetid://11260906114" elseif Stats == "GoldPlus" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Creator" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Tester" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Contributor" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" end local CloneGui = Overheads:Clone() CloneGui.Username.Text = Player.Name CloneGui.Parent = Head CloneGui.Name = "OverheadGui" local Role = "Guest" pcall(function() Role = Player:GetRoleInGroup(GroupId) end) CloneGui.Role.Text = Role end) end)
There were a few issues in your code,
In the original code, the Left and Right variables were being defined outside the Player.CharacterAdded event handler, which means that they would be defined regardless of whether the player's character has been added or not. Since these variables are used later on in the code, this could cause errors if the player's character has not been added yet.
By moving the declarations of Left and Right inside the Player.CharacterAdded event handler, we ensure that these variables are only defined when the player's character is added, which eliminates the potential for errors.
Here is a fixed version of your code:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local Overheads = ReplicatedStorage:WaitForChild("OverheadsGui") local GroupId = 11540689 ----// GROUP ID Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) -- These variables are used regardless of whether the user owns the gamepass or not -- so we can define them outside the if statement local Humanoid = Character:WaitForChild("Humanoid") local Head = Character:WaitForChild("Head") local Left = Overheads:WaitForChild("Left") local Right = Overheads:WaitForChild("Right") local Stats = Player:WaitForChild("playerstats").Rank.Value -- Again, this happens regardless of the if statement Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None if Stats == "Unrank" then Left.Image = "rbxassetid://11260847774" Right.Image = "rbxassetid://11260873360" elseif Stats == "Bronze" then Left.Image = "rbxassetid://11260880194" Right.Image = "rbxassetid://11260884454" elseif Stats == "Silver" then Left.Image = "rbxassetid://11260890595" Right.Image = "rbxassetid://11260895668" elseif Stats == "Gold" then Left.Image = "rbxassetid://11260902279" Right.Image = "rbxassetid://11260906114" elseif Stats == "GoldPlus" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Creator" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Tester" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" elseif Stats == "Contributor" then Left.Image = "rbxassetid://11260911548" Right.Image = "rbxassetid://11260917532" end local CloneGui = Overheads:Clone() CloneGui.Username.Text = Player.Name CloneGui.Parent = Head CloneGui.Name = "OverheadGui" local Role = "Guest" pcall(function() Role = Player:GetRoleInGroup(GroupId) end) CloneGui.Role.Text = Role end) end)