Hello developers.
During the development of my game, I realized that the title screen I made only works in Roblox studio for some reason. When I go into the actual game on the platform, it does not appear initially. Is there anything I’d need to change? I do not know what examples I’d need to provide… Any help is appreciated
--Music and Menu Handler
local frame = script.Parent
local blur = game.Lighting.DepthOfField
local playButton = script.Parent.PlayButton
local ambience = script.Parent.Ambience
local wind = script.Parent.Ambience2
if frame.Visible == true then
blur.Enabled = true
end
if frame.Visible == true then
ambience:Play()
wind:Play()
end
playButton.MouseButton1Click:Connect(function()
frame:Destroy()
end)
playButton.MouseButton1Click:Connect(function()
ambience:Stop()
wind:Stop()
end)
playButton.MouseButton1Click:Connect(function()
blur.Enabled = false
end)
--Menu Camera
local camera = game.Workspace.Camera
local menuCamera = game.Workspace.MenuCamera
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = menuCamera.CFrame
playButton.MouseButton1Click:Connect(function()
camera.CameraType = Enum.CameraType.Custom
end)
-- Credits Gui
local creditsButton = script.Parent.CreditsButton
local creditsFrame = script.Parent.CreditsFrame
creditsFrame.Visible = false
creditsButton.MouseButton1Click:Connect(function()
if creditsFrame.Visible == false then
script.Parent.CreditsFrame.Visible = true
else
script.Parent.CreditsFrame.Visible = false
end
end)
This is the script for my title screen. I do not know why it only works in studio and not in the actual game. I am relatively new to scripting so I may not spot them on my first look-through
You’re only getting the server’s camera from the client side, when you should be getting the CurrentCamera which would be a property of the workspace, and able to manipulate the camera that way
--Music and Menu Handler
local frame = script.Parent
local blur = game.Lighting.DepthOfField
local playButton = script.Parent.PlayButton
local ambience = script.Parent.Ambience
local wind = script.Parent.Ambience2
print("We know this starting part works")
if frame.Visible == true then
blur.Enabled = true
end
if frame.Visible == true then
ambience:Play()
wind:Play()
end
playButton.MouseButton1Click:Connect(function()
frame:Destroy()
end)
playButton.MouseButton1Click:Connect(function()
ambience:Stop()
wind:Stop()
end)
playButton.MouseButton1Click:Connect(function()
blur.Enabled = false
end)
--Menu Camera
local camera = game.Workspace.Camera
local menuCamera = game.Workspace.MenuCamera
repeat wait()
print("Loop running")
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = menuCamera.CFrame
print("Loop broke")
playButton.MouseButton1Click:Connect(function()
camera.CameraType = Enum.CameraType.Custom
end)
-- Credits Gui
local creditsButton = script.Parent.CreditsButton
local creditsFrame = script.Parent.CreditsFrame
creditsFrame.Visible = false
creditsButton.MouseButton1Click:Connect(function()
if creditsFrame.Visible == false then
script.Parent.CreditsFrame.Visible = true
else
script.Parent.CreditsFrame.Visible = false
end
end)
Okay lemme word it a bit better
in studio, the title screen camera positions itself correctly to where it’s supposed to be
but in-game, it starts with the default camera, not the title screen camera
Only things I could potentially see, is that the CameraType could still be set to Custom or the menuCamera variable isn’t exactly connecting in relation with the CFrame of the Player’s Camera