So i created a fade in script that runs for once and then ends. Its played when a certain part is touched. I tried my script but the script doesnt show the tween when the part is touched and idk if my script would make a fade in effect. Is there anyway i can fix this and make it fade in?
script:
local Popup = workspace.power ---------------- Change the "Example" to the name of the part the player needs to touch
local Tweens = game:GetService("TweenService")
local Frame = script.Parent.Popupgui2.Frame
local Frame1 = Frame.ScrollingFrame
local Frame2 = Frame.TextLabel
local Frame3 = Frame.ImageLabel
local Frame4 = Frame.TextButton
Popup.Touched:Connect(function(hit)
if hit.Parent == player.Character then
local Tween = Tweens:Create(Frame, TweenInfo.new(1, Enum.EasingStyle.Linear), {BackgroundTransparency = 0})
Tween:Play()
Tween.Completed:Wait()
Tween:Pause()
local Tween1 = Tweens:Create(Frame1, TweenInfo.new(1, Enum.EasingStyle.Linear), {BackgroundTransparency = 0})
Tween1:Play()
Tween1.Completed:Wait()
Tween1:Pause()
local Tween2 = Tweens:Create(Frame2, TweenInfo.new(1, Enum.EasingStyle.Linear), {BackgroundTransparency = 0})
Tween2:Play()
Tween2.Completed:Wait()
Tween2:Pause()
local Tween3 = Tweens:Create(Frame3, TweenInfo.new(1, Enum.EasingStyle.Linear), {BackgroundTransparency = 0})
Tween3:Play()
Tween3.Completed:Wait()
Tween3:Pause()
local Tween4 = Tweens:Create(Frame4, TweenInfo.new(1, Enum.EasingStyle.Linear), {BackgroundTransparency = 0})
Tween4:Play()
Tween4.Completed:Wait()
Tween4:Pause()
end
end)
local Popup = workspace.power ---------------- Change the "Example" to the name of the part the player needs to touch
local Tweens = game:GetService("TweenService")
local Frame = script.Parent.Popupgui2.Frame
local Frame1 = Frame.ScrollingFrame
local Frame2 = Frame.TextLabel
local Frame3 = Frame.ImageLabel
local Frame4 = Frame.TextButton
local touched = false
Popup.touched:Connect(function(hit)
if touched then
return
end
touched = true
if hit.Parent == player.Character then
local Tween = Tweens:Create(Frame, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0), {BackgroundTransparency = 1})
Tween:Play()
Tween.Completed:Wait()
Tween:Pause()
local Tween1 = Tweens:Create(Frame1, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0), {BackgroundTransparency = 1})
Tween1:Play()
Tween1.Completed:Wait()
Tween1:Pause()
local Tween2 = Tweens:Create(Frame2, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0), {BackgroundTransparency = 1})
Tween2:Play()
Tween2.Completed:Wait()
Tween2:Pause()
local Tween3 = Tweens:Create(Frame3, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0), {BackgroundTransparency = 1})
Tween3:Play()
Tween3.Completed:Wait()
Tween3:Pause()
local Tween4 = Tweens:Create(Frame4, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0), {BackgroundTransparency = 1})
Tween4:Play()
Tween4.Completed:Wait()
Tween4:Pause()
end
wait(.01)
touched = false
end)