Issues with ReplicatedStorage

Hey all, I’m currently working on a game which has a booth system implemented in it. It’s fairly simple, similar to “Rate My Avatar” in terms of design and layout.

In order to get booths to reset after a player leaves, I’ve made it so that when the player leaves, it checks if they own any booths. If they do, the script in the booth gets a backup booth from the ReplicatedStorage and parents it to workspace, then puts it in the place of the old booth, the old booth then destroys itself.

However, there is a small issue. When a player leaves, we get this:

 19:47:21.630  Booth1 is not a valid member of ReplicatedStorage "ReplicatedStorage"  -  Server

-- However, it still says the action was successful

 19:47:21.631  Booth successfully replaced.  -  Server

Here is the current script: (the script.Parent is the old booth)

local BackupBooth = game:GetService("ReplicatedStorage").Booth1
local Players = game:GetService("Players")

Players.PlayerRemoving:Connect(function(player)
	if Values.OwnerValue.Value == player then
		BackupBooth.Parent = workspace.BoothSystem.Booths
		BackupBooth.Position = Vector3.new(script.Parent.Position)
		BackupBooth.Orientation = Vector3.new(script.Parent.Orientation)
		print("Booth successfully replaced.")
		--
		task.wait(2)
		script.Parent:Destroy()
	else
		print("Unable. #booth")
	end
end)

What I’ve actually noticed sometimes, is that the booth does appear, but it does not change its position to its required position.

Any tips, advice, or help would be appreciated.

Hi!
You should remember to clone your backup booth, if you want to use it more than once.

Edit: Or do you “cache” the default-booth in replicatedstorage, while they’re in the game and have claimed the booth?

The default booths are already set up along within the building, and there is a backup one in ReplicatedStorage. When a player leaves or abandons the booth, it destroys the default one and pulls the backup one and places it into the position of the old one.

The backup booth is the same as the old one, just not owned by anybody, so the next person can use it.

Make sure that the Backup is present :slight_smile:

local BackupBooth = game:GetService("ReplicatedStorage"):WaitForChild("Booth1")

Edit: And again, if you’re using 1 backup model for all booths, make sure to clone it everytime you want a backup booth to be placed into workspace.

Unfortunately, it returns the same result, both in the output and game.

However, thank you for the reminder. Almost forgot.

It will tell you that Booth1 is not a part of ReplicatedStorage, if you forgot to clone it. (It’s the clone you have to move to workspace and do stuff to)

Edit: If the error persists, go testplay, and navigate to ReplicatedStorage, and make sure that Booth1 is a child of ReplicatedStorage.

1 Like

Ah, the output seems to work.

I’ll quickly test this out in game and let you know.

Edit: It’s working, thank you, appreciate it.

Have a nice day and happy scripting!

1 Like