Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I change image gui by leaderstats?

Hello! I am trying to change the image of the gui depending on the leaderstats. It is in serverStorage because that is where the billboard gui is in

EDIT 1: BTW it is a overhead Gui

Here is the code.

local LP = game.Players.LocalPlayer
local Image = script.Parent
local leaderstats = LP:WaitForChild("leaderstats")
local Time = leaderstats:WaitForChild("Time")
game.Players.PlayerAdded:Connect(function()

Time:GetPropertyChangedSignal("Value"):Connect(function()
	while wait() do
	if Time.Value >= 0 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
	if Time.Value >= 60 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
	if Time.Value >= 400 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
	if Time.Value >= 500 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
		if Time.Value >= 1000 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
		if Time.Value >= 1200 then
		Image.Image = "rbxassetid://6654794864"
	end
		if Time.Value >= 1600 then
		Image.Image = "rbxassetid://6654795945"
	end
		if Time.Value >= 2000 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
		if Time.Value >= 3000 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
		if Time.Value >= 6000 then
		Image.Image = "rbxassetid://ImagePlaceholder"
	end
		if Time.Value >= 1000 then
		Image.Image = "rbxassetid://lmagePaceholder"
	end
		end
	end)
end)

19 comments

0

When you run the code, what do you see? Is the code working?

0

I see the first image show up, but not the rest of the images when my time value is changed

0

I noticed that the first 5 images are the same, is that a mistake?

0

It is suppose to be the same image gui but different immage

0

Hold on, im looking in to it.

0

oh, its the same gui name but with different drawing on it?

0

yes

0

I think you need to rename the images with different names since there different pictures, the program is displaying the gui, which is great, but since there are different images with the same label, it is probably getting confused.

0

I think all the images should have numbers actually, also, where are you getting the images from? This could help a lot.

0

How are you doing, was this helpful?

0

I put the image id instead of ImagePlaceholder so that it could display that image

0

but still doesnt work

0

I am getting the images from my decals

0

Ok, good to know! Let me do some more research..

0

Are any pictures popping up when you run it, or nothing.

0

Only the image that I set it to in properties.

0

Could you resend the code?

0

Thankyou for being patient with me.

0

I made a few tweaks

1 answer

The new script

local LP = game.Players.LocalPlayer
local rank = script.Parent
Image = {}
Image[1] = "rbxassetid://6654744240"
Image[2] = "rbxassetid://6654785682"
Image[3] = "rbxassetid://6654786566"
Image[4] = "rbxassetid://6654787618"
Image[5] = "rbxassetid://6654788713"
Image[6] = "rbxassetid://6654794864"
Image[7] = "rbxassetid://6654795945"
Image[8] = "rbxassetid://6654796495"
Image[9] = "rbxassetid://6654797149"
Image[10] = "rbxassetid://6654797490"
Image[11] = "rbxassetid://6654797943"



local leaderstats = LP:WaitForChild("leaderstats")
local Time = leaderstats:WaitForChild("Time")
Time.Changed:Connect(function(newvalue)
			if newvalue <= 60 then
				rank.Image = (Image[1])
			else
				if newvalue <= 400 then
					rank.Image = (Image[2])
				else
					if newvalue <= 500 then
						rank.Image = (Image[3])
					else
						if newvalue <= 1000 then
							rank.Image = (Image[4])
						else
							if newvalue <= 1200 then
								rank.Image = (Image[5])
							else
								if newvalue <= 1600 then
									rank.Image = (Image[6])
								else
									if newvalue <= 2000 then
										rank.Image = (Image[7])
									else
										if newvalue <= 3000 then
											rank.Image = (Image[8])
										else
											if newvalue <= 6000 then
												rank.Image = (Image[9])
											else
												if newvalue <= 10000 then
													rank.Image = (Image[10])
												else
													if newvalue <= 99999999999999999 then
														rank.Image = (Image[11])
													end
												end
											end
										end
									end
								end
							end
						end
					end
				end
			end					
end)

9 comments

0

Did this work?

0

no

0

ill be back in 20 minutes or more

0

backk

0

Hello, im still reading your code for errors, thankyou for being patient.

0

Since, the last program was displaying and this is not displaying instead of rewriting the code, maybe revert to the last code, and just change the "image placehold" to the Id. Or did you already try that?

0

What last code?

0

Nvm i found out, and all the "image placeholders" are with the actual decal id

0

Yay! So glad you figured it out!

This discussion is preserved as it was. New answers, comments, and votes are closed.