#Trying to change the player's camera for a main menu screen when they join

32 messages · Page 1 of 1 (latest)

frank otter
#
local cam = workspace.Camera
game.Players.PlayerAdded:Connect(function()
    local camerapart = game.Workspace.customizeSpawn.menuCameraPart
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = camerapart.CFrame
    script.Disabled = true
end)
    

Just does nothing basically, even added a print to check but it never prints.. Script works fine without the function however. Located in startergui

cyan garden
#

Copy and paste this code into a LocalScript. Then, place the local script into StarterPlayerScripts

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local function Camera()
  local camerapart = workspace:WaitForChild("customizeSpawn"):WaitForChild("menuCameraPart")
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = camerapart.CFrame
end

Camera()

-Note that PlayerAdded doesn't work in LocalScript

frank otter
#

I need to be on player added unfortunately because I cant have it running more than once, its a one time menu screen

cyan garden
#

Then you I recommend using remote events in that case.

frank otter
#

Thats what I originally wanted to do but Ive been trying to not use as many lately

#

guess I have no choie

#

choicee*

#

yeah

trail socket
#
print("Hello world!")

frank otter
frank otter
# cyan garden Then you I recommend using remote events in that case.

ok now im just fumbling this completely
server:

game.Players.PlayerAdded:Connect(function(player)
    script.initialCamera:FireClient(player)
end)

client:

script.Parent.OnClientEvent:Connect(function()
    local cam = workspace.Camera
    print("worked")
    local camerapart = game.Workspace.customizeSpawn.menuCameraPart
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = camerapart.CFrame
    script.Disabled = true
end)
frank otter
#

i have literally no idea why this isnt working

cyan garden
#

You are right.

frank otter
#
game.Players.PlayerAdded:Connect(function(player)
    local cam = workspace.CurrentCamera
    print("worked")
    local camerapart = game.Workspace.customizeSpawn.menuCameraPart
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = camerapart.CFrame
end)
#

straight up just not working still

#

i dont get it

#

the function isnt even executing

main roost
#

just make it a local script inside starter player scripts and make no function, just straight starting

#

it will run once player joins

frank otter
main roost
frank otter
#

it worked

#

yea

main roost
#

it will run just when the player joins

frank otter
#

ty

main roost
#

np

pale crypt