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

Script is working when I run it, but not when I play it. Do I need a function?

Asked by 5 years ago

I am making an intro sequence for my game. The script is supposed to create a frame which fades from black to another gui. Here's the code:

--Fade in parts--
local size = UDim2.new(0, 1920,0, 1080)
local pos = UDim2.new(0, 0,0, 0)
local color = Color3.new(0,0,0)
local ScreenGui = Instance.new("ScreenGui",game.StarterGui)
local frame = Instance.new("Frame",ScreenGui)
frame.Size = size
frame.Position = pos
frame.BackgroundColor3=color

--Fade in--
wait(1)
for i = 0, 1, 0.025 do
    frame.BackgroundTransparency = i
    wait(.025)
end

Do I need to add a onPlayerAdded function? I am quite new to this whole scripting thing.

0
dont do Instance.new("Frame",ScreenGui -- remove screen gui this way is deprecated) do frame.Parent = game.Players.LocalPlayer.Backpack tacotown2 119 — 5y
0
What? Why would you think that's deprecated? You can't just go around and call things deprecated because you don't use them, they are deprecated because roblox drops support for them. SteamG00B 1633 — 5y
0
Also caleb, what is the location of your script? SteamG00B 1633 — 5y
0
oh srry somebody once told me it was tacotown2 119 — 5y
View all comments (2 more)
0
Most likely needs a RemoteEvent. TheOnlySmarts 233 — 5y
0
The location is just in workspace SteamG0D calebskate6 0 — 5y

1 answer

Log in to vote
0
Answered by
Synth_o 136
5 years ago
Edited 5 years ago

Read this, It will answer your question:

https://developer.roblox.com/api-reference/class/PlayerGui

0
Good, but make this a comment next time, only make it an Answer if you have an actual Answer. This isn't really an answer but just something to help the guy understand. Good job though. TheOnlySmarts 233 — 5y
Ad

Answer this question