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

Why is Camera:Interpolate() killing the player?

Asked by 3 years ago
Edited 3 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:

local module = require(game.ServerStorage.Table)
local MonitorData = module.ReturnTableOfMonitors()
local MonitorParts = {}
local MonitorFocusParts = {}
for i = 1, #MonitorData do
    for x = 1, #MonitorData do
        table.insert(MonitorParts, MonitorData[i][x])
        print(MonitorParts[x])
        table.insert(MonitorFocusParts, MonitorData[i][x])
        print(MonitorFocusParts[x])
    end
end
local player = game.Players.LocalPlayer
local Camera = game.Workspace.Camera
local PartValue = script.Parent.Parent.PartValue
script.Parent.MouseButton1Click:Connect(function()
    PartValue.Value = PartValue.Value - 1
    Camera:Interpolate(MonitorParts[PartValue.Value], MonitorFocusParts[PartValue.Value], 1)
end)

MODULESCRIPT:

local module = {}
local TableOfMonitorsCameras = {game.Players.LocalPlayer.ItemRacks.MonitorCamera1.CFrame, game.Workspace.ItemRacks.MonitorCamera2.CFrame}
local TableOfMonitorsFocusParts = {game.Players.LocalPlayer.ItemRacks.CameraFocusPart1.CFrame, game.Players.LocalPlayer.ItemRacks.CameraFocusPart2.CFrame}
local ReturnParts = nil
function module.ReturnTableOfMonitors()
    ReturnParts = false and {TableOfMonitorsCameras, TableOfMonitorsFocusParts} or nil
    return ReturnParts
end
return module

0
CurrentCamera* Ziffixture 6913 — 3y
0
It works in other scripts when I don't use CurrentCamera iNot_here 93 — 3y
0
You have the ModuleScript in ServerStorage. That's the problem, the client can't see what's in ServerStorage or ServerScriptService Spjureeedd 385 — 3y
0
I changed it to move into ReplicatedStorage and it's still killing the client. iNot_here 93 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Maybe try using the old one since i really dont know how i whould fix this. And if you got this from a youtube tutorial or what not maybe ask the creator himself... If its not(which i dont think so just in case) maybe try reverting it back so the old one without the module script cause it might take time to figure it out myself but i will try my best to! im very sorry if i didnt do much help myself i cant figure it out as well but i will update you once i do! :D

Ad

Answer this question