Everything work normally except that the image on a variable Left and Right Won't change
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Overheads = ReplicatedStorage:WaitForChild("OverheadsGui")
local IDVIP = 91491857 ----//VIP ID
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 Stats = Player:WaitForChild("leaderstats").Rank.Value
-- Again, this happens regardless of the if statement
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
if
MarketplaceService:UserOwnsGamePassAsync(Player.UserId, IDVIP) then
-- Always indent blocks of code
local Rank = "VIP"
local Left = Overheads:WaitForChild("Left").Image
local Right = Overheads:WaitForChild("Right").Image
if Stats == "God" then
----- THE SCRIPT BELOW WON'T CHANGE THE IMAGE
Left = "rbxassetid://11260911548" --- This is inside of the overhead
Right = "rbxassetid://11260917532" ---This is inside of the overhead
---- EVERYTHING BELOW WORKS NORMALLY
end
local CloneGui = Overheads:Clone()
CloneGui.Username.Text = Player.Name
CloneGui.Rank.Text = Rank
CloneGui.Parent = Head
CloneGui.Name = "OverheadGui"
local Role = "Guest"
pcall(function()
Role = Player:GetRoleInGroup(GroupId)
end)
CloneGui.Role.Text = Role
else
local Left = Overheads.Left.Image
local Right = Overheads.Right.Image
-- Always indent blocks of code
local CloneGui = Overheads:Clone()
CloneGui.Username.Text = Player.Name
CloneGui.Name = "OverheadGui"
CloneGui.Parent = Head
local Role = "Guest"
pcall(function()
Role = Player:GetRoleInGroup(GroupId)
end)
CloneGui.Role.Text = Role
end
end)
end)

1 comment
To think that my laziness makes a problem for me, thanks man.