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

How to print("Hello") if script.Parent image = ... ?

How to print ("helo") if imagebutton have image : XYZ. ( if imagebutton = XYZ then print("Hello) - How to make this ?

Thanks and best regard -PPJASK

1 answer

✓ Accepted answer

first of all, you need to get the assetID of the image, secondly you can do this to make sure its that image:

local ImageInstance = script.Parent
local IMG = "" -- make this your assetID 

if ImageInstance.Image == ("rbxassetid://" .. IMG) then
    print('Hello!')
end

if you wish to make the function when its changed use this:

local ImageInstance = script.Parent
local IMG = "" -- make this your assetID 

local function Changed()
  if ImageInstance.Image == ("rbxassetid://" .. IMG) then
      print('Hello!')
  end
end

ImageInstance:GetPropertyChangedSignal("Image"):Connect(Changed)

read more about GetPropertyChangedSignal here:

https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal

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