Hi, My problem is that the script I have, should detect the value of the stringValue which is True
and False
, the true should do its job, and the false too. But it doesn’t and I don’t know what the fault is.
local Icon = script.Parent:WaitForChild("Icon")
local Button = script.Parent
local waitcache = 0.01
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 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")
StringValueObject.Changed:Connect(function()
script.Parent.MouseButton1Click:Connect(function()
if StringValueObject.Value == "True" then
-- es el de Encendido
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)
wait(tiempo)
script.Parent:WaitForChild("Take").Value = "False"
end
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)
wait(tiempo)
script.Parent:WaitForChild("Take").Value = "True"
end
end)
end)