Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go about of making respawnable spots?

Asked by 4 years ago
Edited 4 years ago

So I am making my own round-based game. The problem is that if a player dies, they can't go back to the map.

I thought of making a LocalScript tell the server that the player has respawned and teleport them to the map but I have no clue if that is going to work, considering if the LocalScript knows there is a map or not.

Instead I could have a RemoteFunction that tells the client if there is a map or not, then the client can ask the server to teleport them. But I'm not sure if that is going to work to.

This seems like a simple question but I'm not able to come up with ideas.

Edit: I thought of a new idea to use SpawnLocations, but I've used them in the past and they are a little hard to work with.

0
Use teams and spawns. RobloxGameingStudios 145 — 4y
0
Is there a better method? I used that in my previous project and it got messy with all the spawn locations and teams 123nabilben123 499 — 4y

1 answer

Log in to vote
1
Answered by
St_vnC 330 Moderation Voter
4 years ago

Add Folder into the map then add Parts and Name them SpawnTeamNumber

local Players = game.Players:GetChildren()
local Map = workspace:WaitForChild(“Map”) -- Change this to the name of ur map
local Spawns = Map:WaitForChild(“Spawns”)

Players.PlayerAdded:Connect(function(Player)
       Player.CharacterAdded:Connect(function()
              local Spawn = math.random(1,Amount of Spawn)
              Player.Character.HumanoidRootPart.CFrame = Spawns[“Spawn”.. Player.Team.Name ..Spawn].CFrame
       end)
end)
Ad

Answer this question