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

How to Fade a ScreenGUI on Character Spawn?

Asked by 3 years ago
Edited 3 years ago

I have a frame in StarterGui that is supposed to fade from BackgroundTransparency 0 to 1 when the character is added into the game, including respawns and first join. I tried this script, located under the frame, but it didn't work.

local plr = game:GetService("Players").LocalPlayer
local blood = script.Parent
local ts = game:GetService("TweenService")
local goal = {BackgroundTransparency = 1}
local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = ts:Create(blood, info, goal)
plr.CharacterAdded:Connect(function()
    blood.BackgroundTransparency = 0
    tween:Play()
    wait(1)
    blood.BackgroundTransparency = 1
end)

Please help.

1 answer

Log in to vote
1
Answered by 3 years ago

Place this Localscript into "StarterCharacterScripts" and remove the character added function but keep its contents.

This will play the Tween whenever your character respawns, including spawning in for the first time.

The GUI can be accessed through plr.PlayerGui.blood

0
Thanks, this worked! Kaexotix 57 — 3y
0
And I see now how it does too Kaexotix 57 — 3y
Ad

Answer this question