Feedback On Moveset System

I made a system which has a custom moveset system.

It has: Custom keybind system, changeable magic, and more

Codes in order:

–Move 1 client code

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

local UIS = game:GetService("UserInputService")

local Keybind = game.ReplicatedStorage.ClientConfigurations.ClientMagicKeybinds.MM1.MM1Keybind
local ChosenMove = Keybind.Parent:FindFirstChild("MoveAssigned")

local Character = Player.CharacterAdded:Wait()

local Cooldown = false
local CooldownTime = 4

UIS.InputBegan:Connect(function(Input, IsTyping)
	print("Holding")
end)

UIS.InputEnded:Connect(function(Input, IsTyping)	
	
	local Stun = Character:GetAttribute('Stun')
	
	if Keybind.Value == nil then
		warn("Keybind Not Found")
		return
	end
	
	if Input.KeyCode == Enum.KeyCode[Keybind.Value] and not IsTyping and Cooldown == false then
		Cooldown = true
		
		if ChosenMove.Value == nil then
			warn("Move Not Assigned")
			Cooldown = false
			return
		end
		
		local Event = game.ReplicatedStorage.ClientConfigurations.ClientMagicEvents:FindFirstChild(ChosenMove.Value)
		
		print("Went Through Client")
		
		if Event == nil then
			warn("Event Not Found")
			Cooldown = false
			return 
		end
		
		local MousePos = Mouse.Hit.Position
		
		print("Event Exists, Firing")
		
		Event:FireServer(MousePos)
		
		task.wait(CooldownTime)
		Cooldown = false
	end
end)

–Move 2 server check

local ClientEvent = game.ReplicatedStorage.ClientConfigurations.ClientMagicEvents.Blast

local Magics = require(game.ServerScriptService.Magics.Magics)

local Moves = require(game.ServerScriptService.Magics.MagicMoves)

local CheckMove = require(game.ServerScriptService.CheckMove)

ClientEvent.OnServerEvent:Connect(function(Player, MousePosition)
	
	print("Got Signal")

	local Move = "Blast"
	
	local Folder = game.ServerStorage.PlayerValues:FindFirstChild(Player.Name)
	local Magic = Folder.Magic
	
	local Stun = Player.Character:GetAttribute("Stun")

	local Found = table.find(Magics, Magic.Value)
	

	if Found and Stun ~= true and Folder.Class.Value == "Mage" then
		
		local Owned = CheckMove.Search(Player, Folder, Move, Magic, Magics)
		
		if Owned ~= true then
			return
		end
		
		print("Found Move, Stun False, Firing")
		
		local PlayerMagic = Magics[Found]
		local EventFolder = script.Parent:FindFirstChild(PlayerMagic)
		local Event = EventFolder:FindFirstChild(PlayerMagic)
		
		Event:Fire(Player, PlayerMagic, MousePosition)
	end
	
end)

Module

local CheckMove = {}

function CheckMove.Search(Player, Folder, Move, Magic, Magics)
	
	local OwnedMoves = {}

	local Index

	for i, v in Folder.OwnedMoves:GetChildren() do

		Index = i

		if v.Name == "OwnedMove" and v.ClassName == "StringValue" then
			print("Replicating Player Move "..v.Value)
			table.insert(OwnedMoves, v.Value)
		end
	end

	for i, v in OwnedMoves do
		if not table.find(OwnedMoves, Move) then
			print("Player Not Owned Move / Suspecting Exploits")
			return false
		end
	end

	print("Checking Index")

	if Index == nil then 
		warn("Player Not Owned Any Moves")
		return false
	end
	
	return true
	
end

return CheckMove

Actual blast move will continue from this code above, different bindable events based on different magic.

Replicated storage where the keybinds and the set moves are handled

each MM stands for “Magic Move” and the number is based on which move it is. I set it so the player can only have 6 moves thats why it only goes from MM1 - MM6

image

Script “Connect blast” is the second script and each folder has its own script, module, and bindable event which the script controls based on the players magic which is sent from the client

image

Storage where the magic, class, and owned magic moves are

image