are you sure its a localscript and not a regular server script?
yea i told him to remove already
he can only define camera on local script so it is local script
still nothing works, its so weird that it perfectly works fine in the studio. yea its a local script
weird it worked me both on studio and on the game
have you set the model PrimaryPart? like in the Properties
yes i did, when i run the script on the studio it works fine, but not in the game
local player = game.Players.LocalPlayer
-- Wait for the character to load
local character = player.Character or player.CharacterAdded:Wait()
print("added")
local car = workspace:WaitForChild("StarterCharacter")
local cam = workspace.CurrentCamera -- Get the current camera
-- Set camera properties
cam.CameraType = Enum.CameraType.Custom
cam.CameraSubject = car-- Set the camera to follow the car
print("Camera set up completed")
You can just do a compound statement on that to check. Note that StarterCharacter
is always named when you place it in workspace, according to the player name(display?), usually.
not working
aaaaaaaaaaaaaaaaaaaa
if printing something on the first line doesn’t work, then changing a line of code that runs AFTER the first line won’t change anything
the print works on studio but not in the game
Just putting up blanket statements like that isn’t helping either of us. You have to elaborate why it is not working and what you are actually expecting.
It should work if it is correctly parented and is actually not on a disabled state.
i think this is just device progress speed problem as mine worked on both try to wait more like 3-5 second
If a script runs in test but not on the server it’s because it’s handled incorrectly.
Your computer runs as the server in studio test mode.
If you run a localscript in Studio it’ll perform and output as both local and server.
Try switching it to a Script instead.
I tried it with more than 1 device all of them have the same problem.
woah that worked!!! can u explain to me that again so I can know exactly what was the problem.
ty all for your help guys, sorry for wasting your times
I’m probably wrong with some details of this information, so if someone has a better explanation please share it.
So when you play a game, Roblox runs the game on their server.
Your computer (the client) receives and sends information about your inputs and gameplay dynamics.
LocalScripts run on the client. Scripts have access to the server depending on where they are located in your game.
When you test the game in Studio Roblox doesn’t open a server for you. Your computer acts as both the client and the server. LocalScripts will act like server scripts in this case.
It helps when troubleshooting because it’s a pretty clear indicator of what’s happening.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.