How would I prevent players from spawning on top of my building instead of inside it?

At the moment, I have a spawn that’s half underwater. I want to keep the location as it is, because I personally think it looks really cool, and makes sense in my game. Unfortunately, because of this, the player spawns on top of the building, instead of inside it. How would I make it so that the player can spawn underwater so they’re able to spawn inside the building?

2 Likes

Have you tried teleporting players to the desired location? This involves minimal scripting, yet is more effective than any spawn brick. Players won’t spawn on top of buildings.

4 Likes

That is an interesting idea, but how would it work for players just joining the game? It’s only a specific team that spawns underwater, so what would a script to teleport them there on start be?

If I understood well her message, the building is the start place.

1 Like

Changing the location of the spawn brick should just work fine. Have you got enough space inside of the building, or anything the player can collide with?

The building is smaller to moderate sized, but the entire area I want them to start in is underwater, although there’s a second floor that peeks out over the ocean a bit.

Can you add a picture so I can see how it looks? And something for size comparison?

I think one solution would be to place the spawn locations under the ground.
The game will then spawn the characters as close as possible to the spawn locations but without spawning them inside solid ground, so it should prevent them from spawning above the building.

And if this doesn’t work, you could also simply place the spawn location at random places then quickly teleport the players to the desired place using a small script.

This is a script I quikcly wrote now outside of Roblox Studio but it should work.

--Let's say players in the blue team are supposed to spawn
--to the custom location X,Y,Z. This gives us the following code:
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local HRP - char:WaitForChild("HumanoidRootPart")

if plr.TeamColor == Color3.new(0, 0, 255) then
    HRP.Position = Vector3.new(X, Y, Z)
end
1 Like

Of course, here’s the photo:
The bottom floor is where I wanted people to spawn, and there’s a shopkeeper in there for some scale reference

Yeah you cant’ spawn inside of water, so you could either remove the water or use teleporters:

With spawners:

With teleporters:

The script is simple:

local Teleport = "Teleporter-reciever" --Put the name of the Part you want to teleport to between the " ".

function Touch(hit) --Indicates that the Part has been Touched.

if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.

local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to.

hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function.

script.Parent.Touched:connect(Touch) --Listens out for Touchers.
1 Like