Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I want to make button that change camera but i get error, how to fix that?

Asked by
kiref81 -24
2 years ago
Edited 2 years ago
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local ReplicatedStorage = game:GetService("ReplicatedStorage")


game.ReplicatedStorage.CameraEvent.OnClientEvent:Connect(function()
    repeat wait()
        Camera.CameraType = Enum.CameraType.Scriptable
    until Camera.CameraType == Enum.CameraType.Scriptable
    Camera.CFrame = workspace["Mercedes Benz Biome"].CameraPart
end)

error: Argument 1 missing or nil

local ReplicatedStorage = game:GetService("ReplicatedStorage")

script.Parent.Triggered:Connect(function()
    ReplicatedStorage.CameraEvent:FireClient()
    print("success")
end)
0
Is this in a Local Script? Also please provide the entire error message strangejmaster43 139 — 2y
0
no its script kiref81 -24 — 2y
0
You need to include .CFrame next to the end line. Camera.CFrame = workspace["Mercedes Benz Biome"].CameraPart.CFrame, also why do you need to put the CameraType in a repeat? RazzyPlayz 497 — 2y
0
None of the above code can produce "Argument 1 missing or nil". Ziffixture 6913 — 2y

Answer this question