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

Camera Manipulation Wont work in game?

i've created a camera manipulation for my custom Gui. How it works is that it moves the camera to follow a brick, when ever a button is clicked. It works perfectly in studio mode The Camera Moves to the next object on every click. Not one signal error comes up. But as soon as i run a server test, or upload it and test it on play, nothing with the camera movement works and i get no errors. My camera controller is in a local script.

local function MoveCamera(Direction)
	local FollowBrick = MoveBrick:InvokeServer(Direction)
	Camera = workspace.CurrentCamera
	if(Direction ~= "End")then
		print("It is not End")
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CameraSubject =  FollowBrick
		Camera.CFrame =  CFrame.new(0,25,1)
		Camera.CFrame = CFrame.new(FollowBrick.Position) * CFrame.new(0,0,1) * CFrame.Angles(0,math.rad(180),0)	
	else
		Parent.Enabled = false
end

2 comments

0

There could be very errors, try using repeat to do repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable could we see the other scripts also?

0

The only thing else is a player touch part script, which would activate the gui(which works), then it would activate this MoveCamera. But i did notice that in stuido it would work and change the Camera type to scriptable, but in game, it is not changing at all.

1 answer

Ok, Let me guess, your script isn't a local script. I have had experience with things working in studio but not in game. If it is a script, it will be trying to access your camera, but can't. workspace.Camera can be done with a local script, because the camera will be local to the player. I would basically just copy your script then make it into a local script.

2 comments

0

It is in a local script

0

Hmm, I should of read "My camera controller is in a local script." I honestly do not know, I would recommend analyzing and understanding your code better.

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