Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Trying to make a fade to black script, it has no errors, and it works, just not the tween?

Asked by
ovicaI 7
3 years ago

script:

local play = game.Workspace.GUIS.SurfaceGui.Frame.TextButton
local fadeframe = game.StarterGui.Fade.Frame
local tween = game:GetService("TweenService")
local sound = play.Clicked
local fade = tween:Create(fadeframe, TweenInfo.new(2, Enum.EasingStyle.Sine), {BackgroundTransparency = 0} )
play.MouseButton1Click:Connect(function()
    sound:Play()
    fade:Play()
    wait(1)
    print("workinbg!!?!")
end)

1 answer

Log in to vote
0
Answered by
sleazel 1287 Moderation Voter
3 years ago

StarterGui is where PlayerGui "templates" are being held. By using expression local fadeframe = game.StarterGui.Fade.Frame you are referencing that template instead of actual PlayerGui.

To solve this please change it to:

local fadeframe = game.Players.LocalPlayer.PlayerGui:WaitForChild("Fade").Frame

This way you will reference actual frame that is on the screen. I added WaitForChild since it is very likely this frame will not load before the script runs.

Ad

Answer this question