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

A global known word/script for undo?

Asked by 6 years ago

So I was having trouble scripting this script:

script.Parent.Touched:Connect(function()
    script.Parent.Color = Color3.new(255/255,0/255,0/255)

And then I wanted to make it to where it would undo it I tried this script:

script.Parent.Touched:Connect(function()
    script.Parent.Color = Color3.new(255/255,0/255,0/255)
    wait(0.1)
    undo
end)

And then I realized undo is not a global known word in lua Anyone know what it is?

1
You cannot use undo, unless you are making a plugin, which in your case, is not a plugin. hiimgoodpack 2009 — 6y
0
Just do the opposite of what you did previously... Or you could store the previous color in a variable and set it back to that... KingLoneCat 2642 — 6y
1
A debounce could work for you.. greatneil80 2647 — 6y
0
use color3.fromRGB abnotaddable 920 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago

What you need is a previous value

local prevColor = script.Parent.Color
local newColor = Color3.new(255/255,0/255,0/255)
script.Parent.Touched:Connect(function()
    script.Parent.Color = newColor
    wait(0.1)
    script.Parent.Color = prevColor
end)

try that.. It changes the new color to the previous color..

Ad

Answer this question