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

How do you make an object go back to its original state after a click?

So I'm very new to Lua. Just started learning like a few days ago. And I've been experimenting on roblox studio, I'm trying to make something that goes from transparent on click, then goes back to it's original state again on click. This is how far I've come

local hi = game.Workspace.Part.Open.MouseClick:Connect(function(click)
	local goner = game.Workspace.Part
	goner.Transparency = 0.5
end)

It may look simple to many of you people but for me it isn't. I'm making this straight from my mind and please don't make fun of me. I'm very new, everyone starts somewhere right?

1 answer

✓ Accepted answer

Maybe try something like this.

local value = true
local goner = game.Workspace. Part
game.Workspace. Part.Open.MouseClick:Connect(function(click)
if value == true then
goner.Transparency = 0.5
value = false
else
goner.Transparency = 0
value = true
end
end)

3 comments

0

Wow thanks man. Appreciate it!

0

No problem. I am happy to help.

0

pls accept answers after you get your answer solved

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