Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.