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

ServerHandler:25: attempt to index nil with Instance ?

Asked by 1 year ago

so im trying to make a skill framework but whenever i try to fire the inputended i receive a trying to index nil with instance on the inputended event

Server Handler script

local RS = game:GetService("ReplicatedStorage")

local ServerRemote = RS.Remotes.Server

local Inputs = require(script.Inputs)
local Functions = require(script.Functions)

game.Players.PlayerAdded:Connect(function(Player)
    Inputs.InputTable[Player] = {}
    Player.CharacterAppearanceLoaded:Connect(function(Character)
        Character:SetAttribute("Stunned",false)
        Character:SetAttribute("Attacking",false)
    end)
end)

ServerRemote.OnServerInvoke = function(Player,Action,Input,Params)
    if Action == "InputBegan" then
        print(Input)

        Inputs.InputTable[Player][Input] = true
    elseif Action == "InputEnded" then
        print("Stopped")
        Input.InputTable[Player][Input] = nil
    elseif Action == "Skill" then
        if Player.Character:GetAttribute("Stunned") == false and Player.Character:GetAttribute("Attacking") == false then
            print(Input)
            local Move = Functions.FireMove(Player,Params)
            return Move
        end
    end
end 

SkillReplicator Script

local InputEnded = coroutine.create(function()
    UserInputService.InputEnded:Connect(function(Input,GPE)
        if GPE then return end
        if Character:GetAttribute("Attacking") == true then 
            Server:InvokeServer("InputEnded",Input.KeyCode.Name)
        end
    end)

end)

coroutine.resume(InputEnded)

Inputs Module

local Inputs = {}

Inputs.InputTable = {}

function Inputs.CheckInput(Player,Input)
    return Inputs.InputTable[Player][Input]
end

return Inputs
0
line 23 typo Input.InputTable should be Inputs.InputTable imKirda 4491 — 1y
0
shame imKirda 4491 — 1y

Answer this question