Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

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 MatoProF 23 — 4y
0
Is image a StringValue? If it is, change its text to the string that I wrote in my answer. youtubemasterWOW 2741 — 4y
0
It is a StringValue, i will test it now MatoProF 23 — 4y
0
Oh i just realized i messed up in other script, sorry for wasting your time :) MatoProF 23 — 4y
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 IdealistDeveloper 234 — 4y
Ad

Answer this question