Changing image through script problem

Hello everyone!

I am trying to make it so people with a certain value get a different image, but I can’t change the image through a script?

Here is the exetremely simple code

GuiClone.Division.ImageLabel.Image = '1'

PS: I tried changing the ’ to " but it does the same thing

1 Like

‘1’ is not a valid image id, a image is should look like:
"rbxassetid://11111111111"

1 Like

But what is the entire script?
That line just tries to makes the image 1 but as @domboss37 said, that’s not valid.

1 Like

change this to

GuiClone.Division.ImageLabel.Image = "rbxassetid://00000000"

instead of the 0’s, put the ID of your Image. Upload it on Roblox, and then copy the numbers from the URL

2 Likes

I just put 1 there, the actualy image id is rbxassetid://10201981573 but it still does not work

1 Like

there is an actual ID there but I just put 1

1 Like

If you put 1 tho, it doesn’t work…Unless you’ve done

local 1 = rbxassetid://0000000

and change it to

GuiClone.Division.ImageLabel.Image = 1
1 Like
	GuiClone.Division.ImageLabel.Image = "rbxassetid://10202071783"
1 Like

That’s the whole script??? All of it??

1 Like

The entire script is

local Players = game:GetService("Players")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.PlayerNametag:Clone()
		GuiClone.Parent = Character.Head
		local Text = GuiClone.Role.Text
		local Username = GuiClone.Username.Text
		local PlayerName = player.Name
		
		

		local PlayerRank = player:GetRoleInGroup() -- Put your group ID in the ()		
		
		local NotInGroup = "Civilian" -- What players not in the group are named
		local NotInGroupColor =  Color3.new(1, 1, 1) -- The GUI's color of the people not in the group
		
		
		
		local MainGroupID = "13355183"  -- Put the main group ID in the " "
		local MainGroupColor = Color3.new(0.227451, 0.396078, 0.580392) -- The color of the main group's gui
		
		
		
		local HRTID = "13506906" -- Put the Second Group ID in the " ".
		local HRTCOLOR = Color3.new(0.623529, 0.180392, 0.231373) -- The color of the second group's gui
		
		local SFID = "13434037" -- Put the Third Group ID in the " ".
		local SFColor = Color3.new(0, 0, 0) -- The color of the third group's gui
		
		local IAID = "13433975" -- Put the Third Group ID in the " ".
		local IAColor = Color3.new(0, 0.12549, 0.376471) -- The color of the third group's gui
		
		local SID = "13433862" -- Put the Third Group ID in the " ".
		local SColor = Color3.new(0.254902, 0.321569, 0.741176) -- The color of the third group's gui
		
		local TAID = "13355801" -- Put the Third Group ID in the " ".
		local TAColor = Color3.new(0.152941, 0.27451, 0.176471) -- The color of the third group's gui
		
		-- [[ CUSTOMIZE ]] --
		
		
		
		
	
		-- SCRIPT -- 
		
		if player:GetRankInGroup(MainGroupID) >= 18 then

			Text.Text = PlayerRank
			Text.TextColor3 = MainGroupColor
			Username.Text = PlayerName
			Username.TextColor3 = MainGroupColor
			GuiClone.Division.BackgroundColor3 = MainGroupColor
			GuiClone.Division.Text.Text = "FBI Headquarters"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10202071783"
			
		elseif player:IsInGroup(HRTID) then

			Text.Text = PlayerRank
			Text.TextColor3 = HRTCOLOR
			Username.Text = PlayerName
			Username.TextColor3 = HRTCOLOR
			GuiClone.Division.BackgroundColor3 = HRTCOLOR
			GuiClone.Division.Text.Text = "Hostage Rescue Team"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10202071783"

		elseif player:IsInGroup(SFID) then

			Text.Text = PlayerRank
			Text.TextColor3 = SFColor
			Username.Text = PlayerName
			Username.TextColor3 = SFColor
			GuiClone.Division.BackgroundColor3 = SFColor
			GuiClone.Division.Text.Text = "Special Forces"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10201970115"
			
		elseif player:IsInGroup(IAID) then

			Text.Text = PlayerRank
			Text.TextColor3 = IAColor
			Username.Text = PlayerName
			Username.TextColor3 = IAColor
			GuiClone.Division.BackgroundColor3 = IAColor
			GuiClone.Division.Text.Text = "Internal Affairs"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10202002219"
			
		elseif player:IsInGroup(SID) then

			Text.Text = PlayerRank
			Text.TextColor3 = SColor
			Username.Text = PlayerName
			Username.TextColor3 = SColor
			GuiClone.Division.BackgroundColor3 = SColor
			GuiClone.Division.Text.Text = "Security"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10202015067"
			
		elseif player:IsInGroup(TAID) then

			Text.Text = PlayerRank
			Text.TextColor3 = TAColor
			Username.Text = PlayerName
			Username.TextColor3 = TAColor
			GuiClone.Division.BackgroundColor3 = TAColor
			GuiClone.Division.Text.Text = "Training Academy"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10201981573"
			
		elseif player:IsInGroup(MainGroupID) then

			Text.Text = PlayerRank
			Text.TextColor3 = MainGroupColor
			Username.Text = PlayerName
			Username.TextColor3 = MainGroupColor
			GuiClone.Division.BackgroundColor3 = MainGroupColor
			GuiClone.Division.Text.Text = "FBI Personnel"
			GuiClone.Division.ImageLabel.Image = "rbxassetid://10201626414"
			
		
		
		else

			Text.Text = NotInGroup
			Text.TextColor3 = NotInGroupColor
			Username.Text = PlayerName
			Username.TextColor3 = NotInGroupColor
			GuiClone.Division.BackgroundColor3 = NotInGroupColor
			GuiClone.Division.Text.Text = " "
			GuiClone.Line.BackgroundColor3 = NotInGroupColor
			GuiClone.Division.ImageLabel.ImageTransparency = 1

		end

	end)
	
		
	
		
	end)


Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait()
	wait(0.8)
	player:LoadCharacter()
end)
1 Like

Server script or local script?

1 Like

The script is a server script but it clones the gui to local

1 Like

Do the other image labels work when setting the image? Or no?

1 Like

I haven’t tested them yet but it’s the same exact script so I assume not?

1 Like

Does setting the Text work?

1 Like

Yes everything else works fine, its just the image

1 Like

script.Parent.ImageLabel.Image = “1234567890”
Not sure if it would work.

1 Like

Are you receiving any errors? Any outputs?

2 Likes

Have you also checked in real time to see whether the Image property actually changes?

1 Like

I have checked into Roblox Studio?

1 Like