Why is Camera:Interpolate() killing the player?
Asked by
4 years ago Edited 4 years ago
I was trying to make a script that would move the camera around sideways with buttons in a shop-like style, but whenever the left button's interpolation is finished, it loop kills the player while giving them a black screen. It used to work before I tried to sync it with a ModuleScript for ease of editing the shop.
LOCALSCRIPT IN RIGHT BUTTON:
01 | local module = require(game.ServerStorage.Table) |
02 | local MonitorData = module.ReturnTableOfMonitors() |
03 | local MonitorParts = { } |
04 | local MonitorFocusParts = { } |
05 | for i = 1 , #MonitorData do |
06 | for x = 1 , #MonitorData do |
07 | table.insert(MonitorParts, MonitorData [ i ] [ x ] ) |
08 | print (MonitorParts [ x ] ) |
09 | table.insert(MonitorFocusParts, MonitorData [ i ] [ x ] ) |
10 | print (MonitorFocusParts [ x ] ) |
13 | local player = game.Players.LocalPlayer |
14 | local Camera = game.Workspace.Camera |
15 | local PartValue = script.Parent.Parent.PartValue |
16 | script.Parent.MouseButton 1 Click:Connect( function () |
17 | PartValue.Value = PartValue.Value - 1 |
18 | Camera:Interpolate(MonitorParts [ PartValue.Value ] , MonitorFocusParts [ PartValue.Value ] , 1 ) |
MODULESCRIPT:
2 | local TableOfMonitorsCameras = { game.Players.LocalPlayer.ItemRacks.MonitorCamera 1. CFrame, game.Workspace.ItemRacks.MonitorCamera 2. CFrame } |
3 | local TableOfMonitorsFocusParts = { game.Players.LocalPlayer.ItemRacks.CameraFocusPart 1. CFrame, game.Players.LocalPlayer.ItemRacks.CameraFocusPart 2. CFrame } |
5 | function module.ReturnTableOfMonitors() |
6 | ReturnParts = false and { TableOfMonitorsCameras, TableOfMonitorsFocusParts } or nil |