
Key Required
![spell keybinds [open source]](https://cdn.kocakz.me/images/52a6fcf78f99d572b7d3fc9e60314ed2541a3f810fffd3f183085f17f4134316.webp)
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)
Not working
@foam52103 did you try press z x c v
@bigskidder Just put the script in, right? I tried pressing it and it didn't work.
@foam52103 execute script and hold the spells book then try press the keys
@bigskidder Which executor do you use?
Work | good