local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local moves = require(game.ReplicatedStorage.Abilities)
if rs:IsRunning() then
--started
end
uis.InputBegan:Connect(function(key,gpe)
if gpe then return end
if key.KeyCode.Name == "One" then
moves["Fireball")](game.Players.LocalPlayer)
end
end)
module:
local module = {}
local abilities = {
["Fireball"] = function(plr)
print(plr)
end,
["Waterball"] = function()
end,
}
return module
error:
23:33:16.796 Stack End - Studio
23:33:16.927 Players.Guest85851592.PlayerScripts.MoveOutputs:17: attempt to call a nil value - Client - MoveOutputs:17
23:33:16.927 Stack Begin - Studio
23:33:16.927 Script ‘Players.Guest85851592.PlayerScripts.MoveOutputs’, Line 17 - Studio - MoveOutputs:17
23:33:16.927 Stack End - Studio
Theres another issue in your local script which is the way you call the function. You have to access the table (abilities) and call the function through that. This script should fix that issue:
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local moves = require(game.ReplicatedStorage.Abilities)
if rs:IsRunning() then
--started
end
uis.InputBegan:Connect(function(key,gpe)
if gpe then return end
if key.KeyCode == Enum.KeyCode.Zero then
moves.abilities.Fireball(game.Players.LocalPlayer)
end
end)
Well this is all running on the client, you’re gonna need to port that code to the server if you want it to show up on other clients, but inside the Fireball function you can just do plr.Move1.Value = value