Some background, I am deving a game and I want the camera to change when you open the door. I wanted to make it easier so I didn't have to use 25000 events, but I need help since I keep on getting the error above. Script:
local TweenService = game:GetService("TweenService")
local CamE = game.ReplicatedStorage:WaitForChild("CameraEvent")
local Cam1 = false
local Cam2 = false
local Cam3 = false
local door1 = game.Workspace:WaitForChild("Door1")
local door2 = game.Workspace:WaitForChild("Door2")
local tweeningInformation = TweenInfo.new(
0.4, -- Speed
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local door1Open = {CFrame = CFrame.new(91.66, 4.05, -17.51) * CFrame.Angles(math.rad(0), 90, 0)}
local door2Open = {CFrame = CFrame.new(82.17, 4.05, -17.51) * CFrame.Angles(math.rad(0), -90, 0)}
local door1Close = {CFrame = CFrame.new(89.07, 4.05, -19.17)}
local door2Close = {CFrame = CFrame.new(84.27, 4.05, -19.17)}
local tween1open = TweenService:Create(door1,tweeningInformation,door1Open)
local tween1close = TweenService:Create(door1,tweeningInformation,door1Close)
local tween2open = TweenService:Create(door2,tweeningInformation,door2Open)
local tween2close = TweenService:Create(door2,tweeningInformation,door2Close)
game.Workspace.Detector1.Touched:Connect(function(hit)
Cam1 = true
CamE:FireClient(Cam1) -- ERROR LINE
door1.CanCollide = false
door2.CanCollide = false
tween1open:Play()
tween2open:Play()
wait(1)
tween1close:Play()
tween2close:Play()
door1.CanCollide = true
door2.CanCollide = true
end)
-- script.Parent.Detector2.Touched:Connect(function(hit)
--tween1open:Play()
--tween2open:Play()
--wait(2)
--tween1close:Play()
--tween2close:Play()
--end)
Local Script:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local CameraE = game.ReplicatedStorage:WaitForChild("CameraEvent")
print("e") -- used to test to see if working
CameraE.OnClientEvent:Connect(function(Cam1)
if Cam1 == true then
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Camera1.CFrame
--else if Cameratype[2] == true then
--end
end
end)

2 comments
which line is the error occurring on, and in what script?
If you view the script to the full extent its line 27