Ok, this is MIND BOGGLING! I am trying to set a very simple value to false and it won’t do it. This code is so easy and simple I don’t know what in the entire world I am doing wrong.
local TweenService = game:GetService("TweenService")
local Object = script.Parent
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut, 0, false, 0)
wait(1)
local canClick = true
local toggle = false
function onClick()
if canClick == true then
canClick = false
local rot = Object.Rotation
local Tween = TweenService:Create(Object, tweenInfo, {Rotation = rot == 360 and 0 or 360})
if toggle == false then
Tween:Play()
wait(0.3)
script.Parent.Parent.Frame:TweenSize(UDim2.new(0, 100, 0, 40), "Out", "Back", 1, false, nil)
script.Parent.Parent.Frame.ImageButton.Position = UDim2.new(0.8, 0, 0.5, 0)
Tween.Completed:Wait()
toggle = true
canClick = true
else
Tween:Play()
wait(0.3)
script.Parent.Parent.Frame:TweenSize(UDim2.new(0, 40, 0, 40), "In", "Back", 1, false, nil)
wait(0.9)
script.Parent.Parent.Frame.ImageButton.Position = UDim2.new(0.4, 0, 0.5, 0)
Tween.Completed:Wait()
toggle = false
canClick = true
end
end
end
script.Parent.MouseButton1Click:Connect(onClick)
while true do
wait(1)
print(toggle)
end
When it is clicked the first time, it runs what is in the toggle == false, and then changes it to true, and but when it runs the else on the second click, it does not change it back to false.
robloxapp-20201231-1617057.wmv (442.9 KB)
I just don’t see it or get it. My guess is that I am missing something so obvious I will laugh at myself when it is figured out.
Also, how do I post clips on the forum that appear as just clickable videos, because every time I try to upload something it comes up as something that needs to be downloaded, as you can see above.