Hi, I am currently making a game called Clothing Store Tycoon and I am making a custom respawning script. It is designed when the player dies, they spawn somewhere depending if they own a tycoon or not.
I have a core handler script that adds a TycoonName value into the player (the place where the leaderstats are at). When you claim a tycoon, that value changes from nil to the tycoon folder name. This means that we can use that to create a system that checks if that value is nil or not.
With that out the way, let's talk about the problem here. I used humanoid.Died to release a signal that tells us when the humanoid dies. Now, I used player.CharacterAdded:Wait() to wait until the player respawns. Finally, I run the rest of the code.
Keep in mind that I have two RemoteEvents: MoveCharacter1 and MoveCharacter2. These events move the character. Comment to this question if you would like to see the server script that sets up the RemoteEvents.
I am not sure what is happening. The first time, it works. The second time and all of the other times you do, it will not work; it will send you to the spawn of the world. That is not good because I want the game to be whenever you die, you respawn at a spawning point depending on if you have a tycoon or not. My only theory is that when it waits, it gets rid of the character. If that is the case, then I am not sure how I will fix this.
View the media and the code block to help build up your answer. If you are unable to answer this question, that is okay. Keep practicing!
Videos:
Test without a tycoon: https://drive.google.com/file/d/1k_4qeMec9cTYVEws9qj1tN7auZUMK8Fd/view (copy and paste link since the link system does not work)
Test with a tycoon: https://drive.google.com/file/d/1k_4qeMec9cTYVEws9qj1tN7auZUMK8Fd/view?usp=sharing (copy and paste link since the link system does not work)
Screenshots:
Explorer screenshot: https://drive.google.com/file/d/1nxbH00lSC88ILbhYXdDn172TyVw1hNTZ/view?usp=sharing (copy and paste link since link system does not work)
Code Block:
local rep = game:GetService("ReplicatedStorage")
local event1 = rep.RemoteEvents:WaitForChild("MoveCharacter1")
local event2 = rep.RemoteEvents:WaitForChild("MoveCharacter2")
local player = game.Players.LocalPlayer
local character = workspace:WaitForChild(player.Name)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
local tycoonName = player:WaitForChild("TycoonName")
if tycoonName then
if tycoonName.Value ~= "" then
player.CharacterAdded:Wait()
event1:FireServer(workspace.Tycoons:WaitForChild(tycoonName.Value))
else
player.CharacterAdded:Wait()
event2:FireServer()
end
end
end)
Server Script:
local rep = game:GetService("ReplicatedStorage")
local moveCharacter1 = rep.RemoteEvents:WaitForChild("MoveCharacter1")
local moveCharacter2 = rep.RemoteEvents:WaitForChild("MoveCharacter2")
moveCharacter1.OnServerEvent:Connect(function(player, tycoon)
local upperTorso = workspace:WaitForChild(player.Name):WaitForChild("UpperTorso")
if upperTorso then
upperTorso.CFrame = tycoon.Essentials.SpawnPart.CFrame
end
end)
moveCharacter2.OnServerEvent:Connect(function(player)
local upperTorso = workspace:WaitForChild(player.Name):WaitForChild("UpperTorso")
if upperTorso then
upperTorso.CFrame = workspace:WaitForChild("StartingSpawnPart").CFrame
end
end)
Let me know if you have any questions or you want me to make edits to this question. Have a good day.

6 comments
Sorry but it does not work. I do not think that the script is functioning correctly.
Could I take a look at your server script?
Sure
The question is updated.
Edited the server script in my answer. let me know if it works
It is not working, but I think it is the LocalScript in the StarterPack. Sorry