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

My intro restarts, and I think its because of my ContentProvider?

When my Load hits 0, it starts my intro, I think my load is hitting 0 more than once, heres my script.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
game.Lighting.Blur.Size = 15

local PlayButton = script.Parent.PLAY

repeat wait()
    Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CameraType = Enum.CameraType.Scriptable

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("TopbarEnabled",false)

repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")

while wait() do
    local Load = game:GetService("ContentProvider").RequestQueueSize
    print('Loading game ('..Load..')')
    if Load == 0 then
        wait(3)
        print("Game Loaded")
script.Soundsx:Play()
script.Parent.Seralee.ImageTransparency = 0
game:GetService("RunService").RenderStepped:connect(function()
    workspace.Camera.FieldOfView = 70 + script.Soundsx.PlaybackLoudness * 0.01
    game.Lighting.Blur.Size = script.Soundsx.PlaybackLoudness * 0.0185
    end)
    wait (21.8)
    script.Parent.PLAY.Active = true
    script.Parent.PLAY.Visible = true
    script.Parent.Seralee.ImageTransparency = 1

    script.Parent.ImageLabel.ImageTransparency = 0.9
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.8
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.7
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.6
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.5
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.4
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.3
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.2
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0.1
    wait ()
    script.Parent.ImageLabel.ImageTransparency = 0

PlayButton.MouseButton1Click:Connect(function()
    Camera.CameraType = Enum.CameraType.Custom
    script.Parent.ImageLabel.ImageTransparency = 1
    script.Parent.ImageLabel.Visible = false
    script.Parent.ImageLabel.Active = false
    game.Lighting.Blur.Size = 15
    wait ()
    game.Lighting.Blur.Size = 12
    wait ()
    game.Lighting.Blur.Size = 9
    wait ()
    game.Lighting.Blur.Size = 6
    wait ()
    game.Lighting.Blur.Size = 5.5
    wait ()
    game.Lighting.Blur.Size = 5
    script.Soundsx:Stop()
    PlayButton:Destroy()
end)
    end
    end

1 comment

0

Use for loop for fading UIs...

1 answer

✓ Accepted answer
while wait() do -- every time u do wait it gos back to this, so even if its in the while do loop is gose back to the begin and starts over. 
--i use like this
local ready is false 
while ready == false do 
	-- ready is some how true like after some count or value = value +or - value 
end -- if ready == true

i would make it like this:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
game.Lighting.Blur.Size = 15
local ready = false --added
local count = 0 --added
 
local PlayButton = script.Parent.PLAY
 
repeat wait()
    Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CameraType = Enum.CameraType.Scriptable
 
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("TopbarEnabled",false)
 
repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")
 
while ready == false do --changed
    local Load = game:GetService("ContentProvider").RequestQueueSize
    print('Loading game ('..Load..')')
    if Load == 0 then
        wait(3)
        print("Game Loaded")
	script.Soundsx:Play()
	script.Parent.Seralee.ImageTransparency = 0
	game:GetService("RunService").RenderStepped:connect(function()
	    workspace.Camera.FieldOfView = 70 + script.Soundsx.PlaybackLoudness * 0.01
 	   game.Lighting.Blur.Size = script.Soundsx.PlaybackLoudness * 0.0185
   	end)
	 wait (21.8)
   	 script.Parent.PLAY.Active = true
    	script.Parent.PLAY.Visible = true
    	script.Parent.Seralee.ImageTransparency = 1
 
    	script.Parent.ImageLabel.ImageTransparency = 0.9
  	  wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.8
   	 wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.7
   	 wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.6
  	  wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.5
  	  wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.4
  	  wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.3
  	  wait ()
	    script.Parent.ImageLabel.ImageTransparency = 0.2
 	   wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0.1
    	wait ()
   	 script.Parent.ImageLabel.ImageTransparency = 0
 
	PlayButton.MouseButton1Click:Connect(function()
 	   Camera.CameraType = Enum.CameraType.Custom
	    script.Parent.ImageLabel.ImageTransparency = 1
	    script.Parent.ImageLabel.Visible = false
	    script.Parent.ImageLabel.Active = false
	    game.Lighting.Blur.Size = 15
	    wait ()
	    game.Lighting.Blur.Size = 12
	    wait ()
	    game.Lighting.Blur.Size = 9
 	   wait ()
 	   game.Lighting.Blur.Size = 6
 	   wait ()
 	   game.Lighting.Blur.Size = 5.5
	    wait ()
	    game.Lighting.Blur.Size = 5
	    script.Soundsx:Stop()
	    PlayButton:Destroy()
	    count = count + 1--added
	    if count >= 3 then --added
		ready = true --added-- when ready is true is stops the while loop else the wait will always start the while loop over and over even if it is in the loop becourse u used wait() in while loop
	   end--added
	end)
    end
end

some thing like this, dont know if it will work now becourse i didnt test it.

7 comments

0

Where would I put those?

0

If its no trouble, could u implement what your doing here to my script.

0

while wait() do- if u do this and then put in the loop or some where else wait() it will go back to the while wait() do so make it while ready == false do

0

Sadly, it did restart again.

0

But using what you created, I think I have found a method that works. Ill accept your answer.

0

thats nice to hear, it also was just an idea, im not that wel with scripting and just starting, but i noticed that i learn fast with scripting. even own ideas i try to figure out how i have to do every thing tutorials help alot with that

0

u can also try it with clone and destroy the script. when done destroy scrip or when player add clone script to his pack or gui or what ever. when destroyed it cant start over again ;)

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