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

A global known word/script for undo?

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?

4 comments

1

You cannot use undo, unless you are making a plugin, which in your case, is not a plugin.

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...

1

A debounce could work for you..

0

use color3.fromRGB

1 answer

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..

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