Im trying to make that when i click on a button it fades out.
Nothing happens when i try to click on the button, but when i put my tween outside MouseButton1Click then it works
my script:
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
script.Parent.Back.MouseButton1Click:Connect(function()
local FadeFrame = PlayerGui.Customization:WaitForChild("FadeFrame")
local tweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
local tween1 = tweenService:Create(FadeFrame, tweeninfo, {BackgroundTransparency=0})
wait(0.1)
tween1:Play()
game.ReplicatedStorage.Customization.UpdateClothing:FireServer(dummy.Shirt.ShirtTemplate,dummy.Pants.PantsTemplate)
script.Parent.Enabled = false
cam.CameraType = Enum.CameraType.Custom
end)
try Activated for the button event, but honestly everything else looks fine to me. try putting prints in the event to see where it doesn’t work or do script.Parent:WaitForChild(“Back”)
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local function tween(obj,value)
local tweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
local tween1 = tweenService:Create(obj, tweeninfo, {BackgroundTransparency = value})
tween1:Play()
end
script.Parent.Back.MouseButton1Click:Connect(function()
local FadeFrame = PlayerGui.Customization:WaitForChild("FadeFrame")
wait(0.1)
tween(FadeFrame,0)
game.ReplicatedStorage.Customization.UpdateClothing:FireServer(dummy.Shirt.ShirtTemplate,dummy.Pants.PantsTemplate)
script.Parent.Enabled = false
cam.CameraType = Enum.CameraType.Custom
end)