I am making a magic game, and I’m trying to figure out how I would manage different states a player would be in during a combat. I don’t want a whole script just some guidance
My problem is I am not sure how I would go about handling states as casting, attacking, stunning etc. I am also planning on adding clashing so I would need other players to check what the enemy state is. If anyone could help me I would really appreciate it.
You should store a table of values, but that can only get accessed only in that script.
If you want it accessed everywhere, I’d use BoolValues.
Option A:
local states = {
StateA = true,
StateB = false,
StateC = false
}
Option B:
game.Players.PlayerAdded:Connect(function(player)
local playerData = Instance.new("Folder", player)
playerData.Name = "PlayerData"
local state1 = Instance.new("BoolValue", playerData)
state1.Name = "State1"
state1.Value = false
--Add more states if you want.
end)