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

Scriptable camera changer doesn't work?

I currently have a part, that when you touches it, changes your camera to scriptable and attaches it to a part. But currently, it just does nothing. Tell me if i'm doing anything wrong.

Server Script inside the touch part:

function OnTouch(hit)
	game.ReplicatedStorage.CameraEvent:FireClient()
	script.Parent:Destroy()
end

script.Parent.Touched:connect(OnTouch)

Local Script inside a starter gui

game.ReplicatedStorage.CameraEvent.OnClientEvent:Connect(function()
	local Camera = game.Workspace.CurrentCamera
	local Player = game.Players.LocalPlayer

	repeat wait() until Player.Character

	Camera.CameraType = "Scriptable"
	Camera.CFrame = game.Workspace.CamPart.CFrame

	script.Parent.Enabled = true
end

Any help would be greatly appreciated!

3 comments

0

I am gonna assume you have left out the part where you actually manipulate the camera, right? Ohh you actually might have copied and pasted the same thing twice..

0

Change FireClient() to FireServer()

0

oops wait sorry, im gonna edit it

1 answer

game.ReplicatedStorage.CameraEvent.OnClientEvent:Connect(function()
    local Camera = game.Workspace.CurrentCamera
    local Player = game.Players.LocalPlayer

    repeat wait() until Player.Character

    Camera.CameraType = Enum.CameraType.Scriptable
    Camera.CFrame = game.Workspace.CamPart.CFrame
end)

When changing the CameraType, it is an Enum value. This means that there are selectable options that are already predefined. Such as a drop down option to change the type of camera.

You also need to add an end) instead of an end to meet the closing bracket of :Connect()

Hope this helps!

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