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

Why script can't change ImageButton's image that i put in value?

So I am trying to make imagebutton have an image that I put in StringValue but I doesn't work, this is the script.

local ReplicatedStorage = game:GetService("ReplicatedStorage"):WaitForChild("ReplicatedStorage_Objects")
local _Image = ReplicatedStorage:WaitForChild("Units"):WaitForChild("Image")

script.Parent.Image(_Image)

This is link for Roblox image http://www.roblox.com/asset/?id=237951922

1 answer

Hello, MatoProF! You don't need all those variables. Instead, just set the ImageButton's image to rbxassetid:// followed by the AssetId. Also, don't start a variable using "_", "=", "+", "-", a number, etc. as it will error.Try this:

script.Parent.Image  = "rbxassetid://237951922"

Please upvote and accept this answer if it helped.

5 comments

0

Yes i know for that but i have more stuff that needs image, I dont want all have same image that is why i put StringValue

0

Is image a StringValue? If it is, change its text to the string that I wrote in my answer.

0

It is a StringValue, i will test it now

0

Oh i just realized i messed up in other script, sorry for wasting your time :)

0

There's nothing wrong with starting a variable using _, go here to find out more about variables: https://developer.roblox.com/en-us/articles/Variables

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