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

Can You guys Please Tell me whats wrong in this script? I'd really appreciate if you answer.

Asked by 10 years ago

I made a Welcome gui , it shows a Play Gui , then loading , then the Camera spins and shows the place , and a Welcome to the game Gui shows up , then when the gui is removed , i dont see the player, and the camera is messed up. At first i made the script as a gui , but there was a problem, the welcome gui kept appearing when ever the player dies. so i made it as a script in work space so it just loads when the player enters the game. 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)


And here is the GUI Script ( Loading and welcome ) Gui's

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()

Thanks, XScriptingMachineX

1 answer

Log in to vote
0
Answered by 10 years ago

That should clean up the GUI script a little bit. Three things you should check: 1) Is the script disabled? 2) Is it a local script if it's supposed to be in the player? 3) Does the player ever get the script? The third one I think is most likely as you cleared everything in the PlayerGui, and you never copied the script, just the welcomeGui. Please comment with questions and corrections. Accept the answer and vote up if it helped, thanks!

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()

for i = 1,75 do
    NewCam.CoordinateFrame = NewCam.CoordinateFrame * CFrame.new(x,y,z)
    wait(.01)
end

wait(.1)
unfade()
wait(1)
script.Parent.Welcome:Remove()
NewCam:Remove()
CurCam.Parent = game.Workspace
script.Parent.Parent.HomeManual.Visible = true
wait(.5)
script.Parent:Remove()

0
Do you want me to make it as a free model , then you can check it out? Please it will really help me improving my self in scripting XScriptingMachineX 0 — 10y
0
I just need more information on what you are trying to do and what is actually happening. GoldenPhysics 474 — 10y
0
Ok , first the preload script is not disabled , and the GUI Loading background's script is disabled , second , the preload script is not a local script , but the Welcome GUI is. third , i tried putting the script u gave me but still havent worked . i just can't see or control my player when the GUI is over , even if i reseted . XScriptingMachineX 0 — 10y
0
I don't know what's wrong with that, though to my best knowledge, the problem isn't in this script, but it could be the CurCam switching. Other than that, I don't know enough to help you. GoldenPhysics 474 — 10y
Ad

Answer this question