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

Why is my camera view change not working?

My goal in this game is to have a camera that changes it's view to show kind of an overview of the town during an ending credits scene, my current script goes as followed.

local camera = game.Workspace.CurrentCamera

(stuff not relating to camera)

camera.CameraType = "Scriptable"
camera.CFrame = workspace.camview.CFrame

It is just simply not changing the view, is there any reason as to why this may be happening?

Like did roblox change how the script is supposed to work since I last did this?

EDIT:

I have modified the script to now be

local camera = game.Workspace.CurrentCamera
local camview = game.Workspace:WaitForChild("camview")

(split)

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = camview.CFrame

Still does not work

EDIT 2:

Isolated everything into a game of it's own,

currently my scripts go as follows:

In StarterGui,

LocalTest:

local TouchDetector = game.Workspace.TD
local module = require(script.Parent:WaitForChild("ModuleTest"))

TouchDetector.Touched:Connect(function()
	module.Test()
end)

ModuleTest:

local module = {}
local replicatedStorage = game:GetService("ReplicatedStorage")

function module.Test()
	
	replicatedStorage.Remotes.Test:FireServer()
	
	
end

return module

Remote event "test" is fired

In ServerScriptService:

TestScript:

local replicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.CurrentCamera
local camview = game.Workspace:WaitForChild("camview")

replicatedStorage.Remotes.Test.OnServerEvent:Connect(function(player)
	
	wait(1) --not in actual game, just to simulate a delay
	
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = camview.CFrame
end)

doesn't work

2 comments

0

try calling a wait for child before "camview". also do camera.CameraType = Enum.CameraType.Scriptable

0

That didn't work, I did both, still just doing nothing

2 answers

ok I solved it,

what I had to do was enable a script in StarterGui and used pretty much the same code but in that script.

either I'm stupid or roblox is stupid but I fixed it.

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