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

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

Asked by
iiAceMo 50
5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
0
Wow thanks man. Appreciate it! iiAceMo 50 — 5y
0
No problem. I am happy to help. dinozaver_triceratop 78 — 5y
0
pls accept answers after you get your answer solved royaltoe 5144 — 4y
Ad

Answer this question