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

My background transparency fade in game intro wont work any help?

Asked by 6 years ago
Edited by User#24403 6 years ago

So the custom cam works but the UI show up does not and the fade in intro does not work either. Any help?

01--//Variables
02local play = script.Parent.Play
03local chapter = script.Parent.Chapter
04local title = script.Parent.Title
05local fader = script.Parent.Fade
06local campart = workspace.Cameras:WaitForChild("JoinedCam")
07 
08while wait(.05) do
09    workspace.Camera.CameraType = "Scriptable"
10    workspace.Camera.CFrame = campart.CFrame
11end
12 
13--//Fade
14fader.Visible = true
15fader.BackgroundTransparency = .1
View all 43 lines...
0
use for loop for the transparency of the "Fader" ~ for i = 0.1,0.7,0.05 do wait (.3) fader.BackgroundTransparency = i ~ xmaanzach 28 — 6y
0
Code Block Please DuckyRobIox 280 — 6y
0
Why you expect him to write the code in a code block? He wrote it in a comment, because that code may not fully solve the issue. Miniller 562 — 6y
0
If you want to fade in smoothly and don't want to do lazy math, I'd suggest using :lerp() and RunService.RenderStepped:Wait() for your wait() function. oilsauce 196 — 6y
View all comments (2 more)
0
tweenserver is better EXpodo1234ALT 18 — 6y
0
Thanks guys! Dev_Coda 31 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Problem

the problem is that you're creating a indefinite while loop over the code, which makes it yield the thread for a indefinite amount of time unless you break it or the condition in it turns false which you cant do that since you set the condition of the loop as the wait() method. also you can just use workspace.CurrentCamera instead, which is the client's camera and theres no need for a while loop anyways. use a for loop instead of setting the transparency each time or you could use TweenService for a smoother effect and more options.

01--//Variables
02local play = script.Parent.Play
03local chapter = script.Parent.Chapter
04local title = script.Parent.Title
05local fader = script.Parent.Fade
06local campart = workspace.Cameras:WaitForChild("JoinedCam")
07local camera = workspace.CurrentCamera
08local player = game.Players.LocalPlayer
09local char = player.Character or player.CharacterAdded:Wait()
10 
11camera.CameraType = Enum.CameraType.Scriptable -- use enums
12camera.CFrame = campart.CFrame
13 
14--//Fade
15fader.Visible = true
View all 36 lines...

and HumanoidRootPart isnt a object of the player object (game.Players.LocalPlayer) but the player's character.

0
also the camera might have not loaded yet, so you might want to put a wait() EXpodo1234ALT 18 — 6y
Ad

Answer this question