if not game:IsLoaded() then game.Loaded:Wait() end local players = game:GetService("Players") local user_input_service = game:GetService("UserInputService") local replicated_storage = game:GetService("ReplicatedStorage") local client = players.LocalPlayer local mouse = client:GetMouse() local packages = replicated_storage:WaitForChild("Packages") local network_c = packages:WaitForChild("NetworkC") local key_binds = {"Z", "X", "C", "V"} local function get_spells() local spell_string = client:GetAttribute("Spells") if not spell_string then return {} end local spells = {} for spell in string.gmatch(spell_string, "([^,]+)") do table.insert(spells, spell) end return spells end user_input_service.InputBegan:Connect(function(input, game_processed) if game_processed then return end local key = input.KeyCode.Name for index, bind in ipairs(key_binds) do if key == bind then local spells = get_spells() local spell = spells[index] if spell then require(network_c):fire("castSpell", spell, mouse.Hit.Position) else print("no spell assigned to this key") end end end end)