How do I start on a turn-based game

I want to make a turn-based combat system but don’t know where to start

any resources that can help me?

3 Likes

I am slightly confused as to what you mean by “turn-based combat system”. Can you elaborate, so we know what you are looking for?

1 Like

don’t you know? like pokemon? one person does their attack, than they wait for other to attack or run or heal etc

2 Likes

A few articles that could help (a quick Google search):

@IceTheOneAndOnly, everyone is looking for something different :man_shrugging: My definition of a turn based combat system would be completely different than the next persons, all depends on what they need and want

2 Likes

alright I’ll check it out thank you

I’m still having a hard time starting the turn system do I use module scripts or normal scripts?

If you require something in a normal script, then the thing you require should be a modules script. You should also know to return it at the end. Example:

local turnBasedCombat = {}
turnBasedCombat.Parent = game.Workspace
return turnBasedCombat
2 Likes

just realized how stupid that question was

2 Likes

Lol. Even me did never know this until maybe a week or so? So no worries, we always learn!

1 Like

Even though this isnt really a guide, its more of a reccomendation, visual stuff like camera, characters and more should be local, stuff that arent visible to the player like, values, datastores and non visual stuff should be serversided.

2 Likes

Use modules, to create functions, for example check who is attacking now (probably setting up a new value in ReplicatedStorage and changing the value on server (dont check the value on client, but check the value on server, it will prevent exploiting) Use local scripts to do things on client for example damage done UI or ability debounce timer. And server scripts you can use, to save stats, or animate abilities (also do damage, never do damage on client, it cant be easily exploited) ok so there are some things you can do in each script.

1 Like

So there is some script, for new battle function in module script

local mainModule = {}

local rep = game:GetService("ReplicatedStorage")

function mainModule.newBattle(player1, player2) --// you can add other things too like battle type
   print("Started new battle with "..player1.Name.." and "..player2.Name.."!")

   local battle = Instance.new("Folder", rep)
   battle.Name = player1.Name.."_"..player2.Name.."_battle"
 
   local attacker = Instance.new("ObjectValue", battle)
   attacker.Name = "Attacker"
   attacker.Value = player1
end

return mainModule

And on server we can start new battle with random players by doing this

local players = game.Players:GetChildren()

local rep = game:GetService("ReplicatedStorage")
local mainModule = require(rep:WaitForChild("MainModule"))

mainModule.newBattle(math.random(1, #players), math.random(1, #players))

Not sure if it works, but this is just an example.

9 Likes

Alright, thank you for helping me.

3 Likes