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.
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.
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.