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

PlayerScripts.Camera:13: attempt to index function with 'Connect'?

Asked by 3 years ago
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera:GetPropertyChangedSignal("CameraType"):Connect(function()
    Camera.CameraType = Enum.CameraType.Scriptable
end)
local Mouse = game.Players.LocalPlayer
local LastY = 0
local LastX = 0
local DefaultCFrame = workspace.Part.CFrame


game:GetService("RunService").RenderStepped:Connect(function()--Up Barrier
    Mouse.Move:Connect(function()   
    if Mouse.Y <= 21 then
    if Mouse.Y - LastY <= -1 then   
    local MoveVector = Vector3.new(0,-(Mouse.Y*1)/7, 0)
    Camera.CFrame = DefaultCFrame * CFrame.new(DefaultCFrame.p + MoveVector)
    DefaultCFrame = CFrame.new(DefaultCFrame.p + MoveVector)
    LastY = Mouse.Y                  
    else LastY = Mouse.Y
           end
        end
    end)    
end)

2 answers

Log in to vote
0
Answered by 3 years ago

The variable for Mouse is the LocalPlayer. Instead change it to local Player = game.Players.LocalPlayer and local Mouse = Player:GetMouse()

1
LMAO HOW DID I MISS THAT THANK YOU THO Eager_Face 4 — 3y
0
np :) kkfilms_1 68 — 3y
Ad
Log in to vote
0
Answered by
sngnn 274 Moderation Voter
3 years ago
Edited 3 years ago

The variable Mouse is the LocalPlayer, not the mouse.

local Mouse = game.Players.LocalPlayer

should be:

local Mouse = game.Players.LocalPlayer:GetMouse()

nvm answered while i was typing :(

Answer this question