Is there anyway to switch 2 value, like I want to achieve like I got 2 value they value is not the same and I when I press a button both of the Value switched place, how should I make that
As I mean, you have for example:
local Box1 = 0
local Box2 = 1
And after pressing button you want make them:
Box1 = 1
Box2 = 0
If yes, this will help you:
local Middle = Box1
Box1 = Box2
Box2 = Middle
1 Like
local clickDetector = script.Parent
local value1 = workspace.Value1
local value2 = workspace.Value2
clickDetector.MouseClick:Connect(function()
local currentValue1, currentValue2 = value1.Value, value2.Value
value1.Value = currentValue2
value2.Value = currentValue1
end)
This is just an example script (makes use of a ClickDetector instance).