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

Why won't the image change? [Solved] [closed]

Asked by
yoshi8080 445 Moderation Voter
8 years ago

When I click the TextButton, the ImageLabel won't change!

button = script.Parent.Parent.Parent.Parent.ScreenGui.Frame.ImageButton
text = script.Parent.Parent.Parent.Parent.ScreenGui.Frame.TextLabel
local chats = {
    "Hello"; 
    "Hi";
}
function Click()
button.Image = "rbxassetid://271666611"
text.Text = chats[math.random(1, #chats)]
end

I forgot a a line in the script

Locked by HungryJaffer, Spongocardo, and woodengop

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
3
Answered by
Wizzy011 245 Moderation Voter
8 years ago

Currently, you've not called the function named "Click", it's only be defined.

To get the image to change, you need to place the code button.MouseButton1Down:connect(Click)on line 11.

This will call the function whenever the button is clicked.

Ad