1

# Why does this Local Script not change an Image after a certain amount of time once it is clicked?

Edited 1 year ago

Up there is a video of what is happenining

Down below is the Local Script that I thought would work.

local Button = script.Parent

local ImageActivated = "rbxassetid://5049442176"
local ImageNormal = "rbxassetid://4888438209"

local function OnButtonActivated()
Button.Image = ImageActivated
delay(3, function()
Button.Image = ImageNormal
end)
end

Button.Activated:Connect(OnButtonActivated)

if parent.Image == ImageActivated then parent.Selectable = false
end
end



ImageActivated hasnt been approved from ROBLOX yet because I had just made the decal that is why it is black i think

0
Edited 1 year ago

"ImageActivated hasnt been approved from ROBLOX yet because I had just made the decal that is why it is black i think"

I tested it for you. It works, just not yet with those decals.

The code is great. Good job!**

Edit: I'm wrong.

When I went to your video I was puzzled as to why it wouldn't work on my screen at all but it somewhat worked on yours. So I did some research.

I tested it with my decals. I got the asset ID by putting my decals/images on a decal object in-game. That's why I jumped to my answer that I originally had.

To get a real asset ID you go to your link here: https://www.roblox.com/library/4888438209/Images-about-to-throw-die and paste that into the "texture ID" area for a Decal object in studio.

The decal object will then auto-correct to the right ID (it will clearly say it). That is how you know what to use.

local Button = script.Parent
local ImageActivated = "rbxassetid://5049442168" -- these are the correct assetid's
local ImageNormal = "rbxassetid://4888438200"
Button.Image = ImageNormal -- this makes it so the image is image normal to begin with
function OnButtonActivated()
Button.Image = ImageActivated
delay(3, function()
Button.Image = ImageNormal -- the function is last changed to image normal
end)
end

Button.MouseButton1Click:Connect(OnButtonActivated) -- for some reason I couldn't get .Activated to work but mousebutton1click worked.


0
LOL nice greatneil80 2546 — 1y
1
How come if i add if parent.Image == ImageActivated then parent.Selectable = false (next line) end (next line) end does not allow the Image to change? Jakob_Cashy 67 — 1y
0
@jakob_cashy I don't understand. It works for me, at least I was under the impression that when you said parent.Image you mean the variable Button where you defined it as script.Parent. It works for me, unless I'm missing something. Put the code in an edit of your original post and Ill try to debug it. legoguy939 403 — 1y
0
this is my first post on this account apparently, cool, dice o mathy is SO MUCH BETTER from when this happened Jakob_Cashy 67 — 1y