I’ve been wondering on how I should approach making bosses for a multiplayer PvE game. Originally my plan for the game would just to be make it singleplayer but that wouldn’t recieve well on Roblox. It’s a story driven combat game with cutscenes and I want it to be possible to fight bosses for one person and another person can be fighting the boss. I understand that if I handle this on the server once one person kills the boss they kill it for everyone and making a boss for every single player would be laggy. I’m not sure if other games have done this so my question is how should I make chronological story bosses for each client to fight throughout the story in a multiplayer game?
This is the exact same problem that I’ve been facing in my game. I’m not sure how your game is exactly set up, but what I have been doing is writing the boss’s battle script in a module script. When a player touches the boss spawn area for the first time (you can use datastore to detect if it is the first time), require the module script from a local script stored in the StarterPlayerScripts and the boss fight will run for the player. Additionally, my game is set up with mini-bosses that lead up to the final boss. I have not reached the final boss yet, but when I design him, he is going to be in a separate game (using a teleportation event) so that the server can process complicated physics due to a more complicated boss fight without interfering with other players.
If using a local script is out of the mix for you, or I misread your question, another thing you can do is simply use more variables. For example, when a player spawns a boss, set an attribute in the Boss like
Boss:SetAttribute("Target",player.Name)
You can then process damage and events for each player, making sure they interact with the correct boss (pretending the player is using a sword)
sword.HitBox.Touched:Connect(function(hit)
if hit.Parent:GetAttribute("Target") == player.Name then
Boss.Humanoid:TakeDamage(10)
end
end
and vice-versa for the boss attacking the player
Boss.Sword.HitBox.Touched:Connect(function(hit)
if hit.Parent.Name == Boss:GetAttribute("Target") then
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
end
end
-Edit: One additional thing to note is that if you do not include several checks for the local scripts, they can be easily exploited
Does any of this help you?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.