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

Why is the Image not rendering?

Hey,

I'm having trouble with Inserting an Image into a ImageLabel via. a LocalScript

Here is my Code:

local Item1 = script.Parent.Parent.List["1Item"]

game.ReplicatedStorage.FoodClickHandler.OnClientEvent:Connect(function(Food, ImageId)	
	Item1.Image = "http://www.roblox.com/asset/?id="..ImageId
end)

The ImageId is the following: 720401998

If the Local Script runs the Image changes to a transparent background!

I hope somebody can help me

EDIT There is a Error in the console:

 Image "https://assetdelivery.roblox.com/v1/asset?id=720401998" failed to load in "Players.RedstonecraftHD.PlayerGui.FoodGui.List.1Item.Image": Request failed

5 comments

0

Send server script that fires the event

0

Already done...

0

SERVER CODE: local clickDetector = script.Parent.ClickDetector local RemoteEvent = game.ReplicatedStorage.FoodClickHandler clickDetector.MouseClick:Connect(function(player) local Food = script.Parent.Name local ImageId = game.ServerStorage.FoodIconIds:FindFirstChild(Food) RemoteEvent:FireClient(player, Food, ImageId.Value) end)

0

Not in a comment, there is an edit button for a reason

0

Sry

1 answer

✓ Accepted answer

Instead of doing

 Item1.Image = "http://www.roblox.com/asset/?id="..ImageId

I would simply suggest that you would do

Item1.Image = "rbxassetid://" .. ImageId

The reason for this is that images do not render if you provide a URL from the Roblox website. There is a special URL, rbxassetid:// that you will have to use for it to render.

If you would put an ordinary URL, the image would not load and it would turn into the transparent background you were talking about.

I hope you would find this as a solution.

2 comments

0

It isn't working! I found a Error in the console (view edit in the post).

0

Your image may be deleted or under moderation by Roblox.

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