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

How would I use a button to make an image appear? [closed]

Asked by 4 years ago

I am making a game and in part of it, you press a button on the screen and an image shows up. How can I script the button so when you click it the image pops up?

Closed as Not Constructive by ScuffedAI, User#32819, Nguyenlegiahung, PrismaticFruits, JakyeRU, and User#5423

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

local script in the button

local thingthatappears = location of the image that will appear

script.Parent.MouseButton1Click:Connect(function()
if thingthatappears.Visible == false then
thingthatappears.Visible = true
end
end)

make sure thingthatappears.Visible = false before the script runs. This is only the most basic way to use guis. You can use things like TweenService to your liking. Looks complicated, but once you learn it, you look like a pro. Really recommend checking it out.

https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition

Ad