Well sorry for making another post like it, but I need this to save scripts and memory. The anti-bounce does not work, it does not activate when pressing the text button, or changing it does not activate the script, I would really appreciate if you could help me.
local Icon = script.Parent:WaitForChild("Icon")
local Button = script.Parent
local OpenPosition = UDim2.new(0.85, 0, 0.5, 0)
local ClosePosition = UDim2.new(0.15, 0, 0.5, 0)
local tiempo = 0.3
local Debounce = false
local TweenService = game:GetService("TweenService")
local Fire = game:GetService("ReplicatedStorage"):WaitForChild("ConfiguracionGeneral"):WaitForChild("JuegoConfg")
local time = 1
local GUISave = game:WaitForChild("ReplicatedStorage"):WaitForChild("GUI"):WaitForChild("FrameSave")
local StringValueObject = script.Parent:WaitForChild("Take")
-- es el de Encendido
script.Parent.MouseButton1Click:Connect(function()
if not Debounce then return end
Debounce = true
if StringValueObject.Value == "True" then
Icon:TweenPosition(OpenPosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.7, true)
local FadeOut = TweenService:Create(Icon, TweenInfo.new(time), {ImageColor3 = Color3.new(0.501961, 1, 0.501961)})
local FadeInOut = TweenService:Create(Icon, TweenInfo.new(time), {BackgroundColor3 = Color3.new(0.407843, 0.701961, 0.317647)})
local FadeInColor = TweenService:Create(Button, TweenInfo.new(time), {BackgroundColor3 = Color3.new(0.317647, 0.541176, 0.313725)})
FadeOut:Play()
FadeInOut:Play()
FadeInColor:Play()
Icon.Image = "http://www.roblox.com/asset/?id=6652973166"
wait(tiempo)
end
wait(tiempo)
Debounce = false
script.Parent:WaitForChild("Take").Value = "False"
end)
--Apagado
script.Parent.MouseButton1Click:Connect(function()
if not Debounce then return end
Debounce = true
if StringValueObject.Value == "False" then
Icon:TweenPosition(ClosePosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.7, true)
local FadeIn = TweenService:Create(Icon, TweenInfo.new(time), {ImageColor3 = Color3.new(1, 0.537255, 0.537255)})
local FadeInOut = TweenService:Create(Icon, TweenInfo.new(time), {BackgroundColor3 = Color3.new(0.509804, 0.509804, 0.509804)})
local FadeInColor = TweenService:Create(Button, TweenInfo.new(time), {BackgroundColor3 = Color3.new(0.529412, 0.313725, 0.313725)})
FadeIn:Play()
FadeInOut:Play()
FadeInColor:Play()
Icon.Image = "http://www.roblox.com/asset/?id=6652972833"
wait(tiempo)
end
wait(tiempo)
Debounce = false
script.Parent:WaitForChild("Take").Value = "True"
end)