Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Load Character button Help?

I just realized i dont need to change the spawn i need to change the script.. so the script is supposed to reload your character on the right spawn

[I need help on spawning you on your actual spawn]

[If your on red team, then you spawn on red spawn, etc]

local Button = script.Parent
local Hold = nil

Button.MouseButton1Down:connect(function()
	if (Hold ~= nil) then return end
	Hold = true
		
		for i = 1,5 do
   		 Button.Text = 5 - i
   		 wait(1)

end

	Button.Parent.Parent.Parent:LoadCharacter(true)

	Hold = nil
end)

2 comments

0

Are you just trying to make this the only game's spawn location?

0

No im trying to make it so you teleport to your "real" team spawn cause when you join game you spawn in safe zone (Neutral Spawn) and after 5 seconds the teleport works for you to go to the game battlefield but there is a button that makes you respawn / load character and it takes you back to the safe zone

2 answers

A Player has a property called RespawnLocation. To set that property, the instance you are trying to set to it must be a SpawnLocation. Just do

game.Players.LocalPlayer.RespawnLocation = Neutral

and it should work fine. Hope this helped!

Be sure to click Accept Answer if this helped you.

'So for my game i am making it so you spawn on the spawn when you enter the game but after you spawn there once you will no longer spawn there..'

Place a local script inside StarterPlayerScripts which is in StarterPlayer and put this source inside:

local player = game.Players.LocalPlayer -- defining the player
repeat wait() until player.Character -- waiting until player has a character
player.Character:MoveTo(workspace.SpawnLocation.Position) -- moving the character to first time spawn

This will solve your first time spawn problem.

All the best.

This discussion is preserved as it was. New answers, comments, and votes are closed.