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

main Menu Camera sometimes shows the player?

i have a main menu with a camera that shows a group of people for with a GUI that says "play". but for some reason its works occasionally. and most of the time it camera is set to the player with the GUI still there making it useless. the GUI works perfectly. but with that error, it's useless

my script

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer

repeat wait() until Player.Character

Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CAM2.CFrame

script.Parent.Enabled = true
script.Parent.Background1.Visible = true
script.Parent.Strike:Play()
script.Parent.Parent.HealthGui.Enabled = false

can someone tell me whats wrong?

3 comments

0

Haiiiii! On line four, you have an oopsie -.- See here for more information https://devforum.roblox.com/t/avoiding-wait-and-why/244015

0

Just to let you know, there's a simple fix. Replace line four with "Player.CharacterAdded:Wait()"

0

thank you

1 answer

Try this:

local Camera = workspace.CurrentCamera

Camera.CameraType = "Scriptable"
Camera.CFrame = workspace.CAM2.CFrame

script.Parent.Enabled = true
script.Parent.Background1.Visible = true
script.Parent.Strike:Play()
script.Parent.Parent.HealthGui.Enabled = false

It doesn't wait for the character, it just sets it immediately to the play screen

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