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

Hello, Can you guys please tell me whats wrong in this script?

Asked by 10 years ago

Ok, So , I'm Making A " Welcome Gui " for my game , this welcome gui allows you to press on " Play " Then a loading gui shows up , then The camera spins around the place and says " Welcome to ( The Game) " . What is wrong is that , when those Gui's end , The camera gets messed up , like, i cant control my player from his camera , it just show me one spot , ( i'm sure you will understand when you see the script ) . Ok So , i didnt want this gui to show up everytime the player dies so , i have put it as a script , not as a gui in player Gui . Here is the preload script : function onPlayerEntered(newPlayer) repeat wait() until newPlayer:FindFirstChild("PlayerGui") ~= nil newPlayer.Character:Remove() wait(1) for i,v in pairs(newPlayer.PlayerGui:GetChildren()) do v:Remove() end local welcome = script.WelcomeGui:clone() welcome.Parent = newPlayer.PlayerGui end game.Players.ChildAdded:connect(onPlayerEntered)


Here is the Welcome background Gui : local CurCam = game.Workspace.CurrentCamera local NewCam = Instance.new("Camera") local x = -.6 -- around (-0-) local y = .08 -- up/down local z = 2 -- zoom out

function fade() repeat wait(.01) script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + .05 script.Parent.Welcome.TextTransparency = script.Parent.Welcome.TextTransparency - .05 NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) until script.Parent.BackgroundTransparency >= 1 end

function unfade() repeat wait(.01) script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency - .05 script.Parent.Welcome.TextTransparency = script.Parent.Welcome.TextTransparency + .05 NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) until script.Parent.BackgroundTransparency <= 0 end

CurCam.Parent = game.Lighting NewCam.Parent = game.Workspace NewCam.CameraSubject = workspace.CamSub NewCam.CoordinateFrame = CFrame.new(-88.502, 107.787, 113.08) NewCam.Focus = workspace.CamSub.CFrame

script.Parent.Loading.Visible = true wait(1) script.Parent.Loading.Visible = false wait(1)

fade()

NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.1) script.Parent.Loading.Visible = false unfade() wait(1) script.Parent.Welcome:Remove() NewCam:Remove() CurCam.Parent = game.Workspace script.Parent.Parent.HomeManual.Visible = true wait(.5)

script.Parent:Remove()

I'm sure that the error is in the above script. Please help me out, i'd really appreciate it . Thank you. XScriptingMachineX

0
Put it into code block or we can't tell you what is wrong. Tempestatem 884 — 10y
0
Ok, im new here so , i didnt know i could do that XScriptingMachineX 0 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Ok , the Preload Script :

function onPlayerEntered(newPlayer) repeat wait() until newPlayer:FindFirstChild("PlayerGui") ~= nil newPlayer.Character:Remove() wait(1) for i,v in pairs(newPlayer.PlayerGui:GetChildren()) do v:Remove() end local welcome = script.WelcomeGui:clone() welcome.Parent = newPlayer.PlayerGui end game.Players.ChildAdded:connect(onPlayerEntered) 

The Welcome Gui :

local CurCam = game.Workspace.CurrentCamera local NewCam = Instance.new("Camera") local x = -.6 -- around (-0-) local y = .08 -- up/down local z = 2 -- zoom out

function fade() repeat wait(.01) script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + .05 script.Parent.Welcome.TextTransparency = script.Parent.Welcome.TextTransparency - .05 NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) until script.Parent.BackgroundTransparency >= 1 end

function unfade() repeat wait(.01) script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency - .05 script.Parent.Welcome.TextTransparency = script.Parent.Welcome.TextTransparency + .05 NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) until script.Parent.BackgroundTransparency <= 0 end

CurCam.Parent = game.Lighting NewCam.Parent = game.Workspace NewCam.CameraSubject = workspace.CamSub NewCam.CoordinateFrame = CFrame.new(-88.502, 107.787, 113.08) NewCam.Focus = workspace.CamSub.CFrame

script.Parent.Loading.Visible = true wait(1) script.Parent.Loading.Visible = false wait(1)

fade()

NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.01) NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z) wait(.1) script.Parent.Loading.Visible = false unfade() wait(1) script.Parent.Welcome:Remove() NewCam:Remove() CurCam.Parent = game.Workspace script.Parent.Parent.HomeManual.Visible = true wait(.5)

script.Parent:Remove()
Ad

Answer this question