Image Button not changing image when told in a script!

I have an ImageButton that changes colors based on the players rank in a group! I have all the different colors as decals, uploaded to roblox, and in a script. I don’t know what is wrong with it, if it is the code for it, the decal not loading, or what. When the script runs, after the wait command, it just becomes blank. I saw a similar topic but couldn’t figure out how to change a decal to an image. Here is the code:

local Player = game.Players.LocalPlayer
local UserId = Player.UserId

local GroupId = 13559378
local PlayerRank = Player:GetRankInGroup(GroupId)


wait(3)
if PlayerRank >= 1 and PlayerRank < 125 then
	script.Parent.Image = "rbxassetid://15136903628"
elseif PlayerRank >= 125 and PlayerRank < 130 then
	script.Parent.Image = "rbxassetid://15136905009"
elseif PlayerRank >= 130 and PlayerRank < 150 then
	script.Parent.Image = "rbxassetid://"
elseif PlayerRank >= 150 and PlayerRank < 175 then
	script.Parent.Image = "rbxassetid://15136906751"
elseif PlayerRank >= 175 and PlayerRank < 200 then
	script.Parent.Image = "rbxassetid://15136909126"
elseif PlayerRank >= 200 and PlayerRank < 253 then
	script.Parent.Image = "rbxassetid://15136904489"
elseif PlayerRank >= 253 and PlayerRank < 255 then
	script.Parent.Image = "rbxassetid://15136905928"
elseif PlayerRank == 255 then
	script.Parent.Image = "rbxassetid://15136884888"
end

To convert those decals into an ImageId, create a new ImageLabel in StarterGui, and paste the number from the decal id into it. It should generate an ImageId for you to use.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.