I am making a combat game, but instead of spawning in instantly to the map, they spawn on a safe part outside the map and the player controls are disabled, they press a button on the Main Menu, and it teleports them to the main map, I put a trigger so I can use the coordinates to teleport the players to the map after their press the “Play” button. I’ve tried doing this, but I have 0 idea on what I am doing, so please, can anyone tell me how can I achieve this?
First, assuming you have it where players can click play and tp to their location. Ill just explain how you can prevent them from dying once they spawn
I personally would have a bool value inside of the player name ‘Attackable’ or something like that and once you spawn in the player wait a certain amount of seconds and change that to true, make sure your weapons check if the ‘Attackable’ is true or not to prevent spawnkilling
My Combat system is very complex and a lot of code is written in it, I would do that too, but implementing a boolean system in the combat would be very hard.
That’s why I am aiming to make a Safe-zone.
Use GetPartBoundsInBoxthen is what I would recommend if you want I can show you a example
I’m not sure I understand, can you elaborate?
GetPartBoundsInBox checks if a player is touching or inside of a ‘Part’/‘Zone’, so do a if then check and if their in a part make them invincible. If you dont want a Bool value you can increase their HP by a large margin, use the force field, and possibly other ways
That’s tempting, but Invincibility breaks some things, combat ignores force field, so that’s why I am aiming to make a safe place far away from the map, or I could do something like this:
The character could spawn after clicking the “Play” button, if it’s even possible to do so.
Sorry if I sound a bit confused, but your trying to make a safe zone? Or are you trying to make it where players dont get spawn killed when they click play and teleport to a battle arena?
I’m sorry if I was unclear.
So, the player’s avatar spawns in, but they are not on the map yet, there’s an invisible, but collideable part far away from the main map the players stand on before clicking the “Play” button, and their controls are disabled to avoid issues (I don’t think anyone would move on the title screen, but still, to ensure everything is okay there). After clicking the button, there’s a trigger in the main map and the avatar has to teleport to that trigger after clicking the button.
If I am still being unclear, please tell me right away and I’ll explain further.
Ok I got that, so your wanting to know how to prevent players from getting killed once they spawn on THE map, right?
I would once again recommend a bool value to check if players can be attacked or not from my above post.
But since you want another way what about making the players fall from a high distance, or have a part in midair to despawn/turn uncollidable after a few seconds when the player touches it.
If your combat system uses the roblox health metric, just set the player’s health to something like 10000000000 so that the attacks won’t kill them until they actually leave the safe zone.
Apply a ForceField, thats what a lot of Combat Games on Roblox Do to Prevent Damage, as long as you arent directly telling the Health to be Changed like so:
Humanoid.Health -= 10 -- Dont Do this
-- This is Declaring the Humanoid's Health to be Taken away
-- Can be killed through ForceField
Humanoid:TakeDamage(10) -- Do this
-- This is Calling a Function to Take Away the Humanoids Health
-- The Function Prevents Damage when using a ForceField
No, I want to know how to bring those players to that safe place far away from the map, because when the character spawns, it’s instantly on the main map, console doesn’t really yell out anything.
I would have a script inside player character(Every time player dies this script runs) and just grab player CFrame and move it to a ‘Safe Zone’
Is this what you wanted to know?
I tried, but using CFrames didn’t work.
Maybe I can use a SpawnLocation?
Put all spawn locations in a safe area, and have normal parts(Teleporting parts) in the arena. This will prevent players starting out inside of the battle area
You make a neutral team where it’s safe from enemies and 2 teams ur original team and enemy team and it’s just a matter of changing the players team and loading the character back in
Here try this, I just tested this
Put this in starter character, each time they die they will teleport to that part(‘Safe Zone’)
local player = game.Players.LocalPlayer
local charac = player.Character
if charac:FindFirstChild("HumanoidRootPart") then
charac:WaitForChild("HumanoidRootPart").CFrame = workspace:WaitForChild('SpecialPart').CFrame--Special part is your safe zone
end
Yeah, I put a SpawnLocation in the Safe Place, and then make the character teleport to a trigger hidden in the main map after clicking the button. Thanks to everyone for trying to help anyway!
The normal spawn will be safe place and sPawnA will be a part that acts as a spawn
local spawnA = workspace.spawnA
script.Parent.TextButton.MouseButton1Clicked:Connect(function()
game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = spawnA.CFrame
end)