RespawnLocation Selection not working properly

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Basically, I am trying to make a spawn location selector, the player should select the location he wants and then it’s just gonna set to that location.

  2. What is the issue? I’ve tried using the script down below, however doesn’t work, it’s just works randomly instead of spawning in that chosen spawn location.

  3. What solutions have you tried so far? I’ve tried adding TakeDamage(100) and Health = 0 to respawn, but it just makes it worse. By the way, it’s a main menu where the user choose the spawn location.

local IAV = false
local ImmigrantV = false
local JediV = false
local RebelV = false
local BaseV = false
local BorderV = false
local Event = game.ReplicatedStorage.EventsForMenu.ShareDivision
local SpawnEvent = game.ReplicatedStorage.EventsForMenu.ShareSpawn
local EndEvent = game.ReplicatedStorage.EventsForMenu.StartEnd
local LocalPlayer = game.Players.LocalPlayer

Event.Event:Connect(function(Immigrant, IA, Jedi, Rebel)
	ImmigrantV = Immigrant
	JediV = Jedi
	RebelV = Rebel

SpawnEvent.Event:Connect(function(Base, Border)
	BaseV = Base
	BorderV = Border

	if ImmigrantV then
		LocalPlayer.Team = game.Teams.Immigrant
	elseif RebelV then
		LocalPlayer.Team = game.Teams.Rebel
	elseif JediV then
		LocalPlayer.Team = game.Teams.Jedi
	elseif IAV then
		LocalPlayer.Team = game.Teams["Imperial Army"]

	if BorderV then
		LocalPlayer.RespawnLocation = workspace.Locations.Border
	elseif BaseV then
		LocalPlayer.RespawnLocation = workspace.Locations.Base

	script.Parent.Parent.Parent.Parent.MainScreen.Enabled = false

	print("Fired! (Local x1)")

It’s a localscript, btw.

Someone could please help me with my script, if possible. I appreciate your assistance :grin:

1 Like

Hi, It’s due to the script being a Local script. The Server needs to know the players spawn location to bring them to it, a local script only tells the client so you’re gonna have to use a Server Script here.

I did it, but still not working. Maybe I should also add the TakeDamage to reset.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.