When The Player Rejoins a Fourth Time There Appearance Doesn't Go On To The Dummy

Streamable.com Video
there was an error every time i tried to upload this so i used streamable

in the vid when they rejoin a fourth time they don’t show up and the more the people the lower they can re join so lets say there’s 2 people and the person rejoins the 3rd time they don’t show up and if there’s 3 people and the person rejoins a 2nd time they don’t show up and so on and so on

here’s the script

-- // Services
local Players = game:GetService("Players")

-- // Variables
local Dummies = workspace.Dummies:GetChildren()

local DummyCharacters = {}

-- Setup all the dummies into the table
for _, dummy in pairs(Dummies) do
	table.insert(DummyCharacters, {Model = dummy, Player = nil})
end

-- // Functions

-- Player joins the game and set one of the available dummise to the player
Players.PlayerAdded:Connect(function(Player)

	-- Loop through all the dummies
	for _, dummy in DummyCharacters do

		-- Check if the dummy already have a player assigned and if it has a Humanoid object
		if not dummy.Player and dummy.Model:FindFirstChild("Humanoid") then
			-- Set the player
			dummy.Player = Player

			-- Get the HumanoidDescription
			local HumanoisDescription = Players:GetHumanoidDescriptionFromUserId(Player.UserId)

			-- Apply the HumanoidDescription
			dummy.Model:FindFirstChildOfClass("Humanoid"):ApplyDescription(HumanoisDescription)
			
			dummy.Model:FindFirstChild("Right Arm").Transparency = 0
			dummy.Model:FindFirstChild("Left Arm").Transparency = 0
			dummy.Model:FindFirstChild("Right Leg").Transparency = 0
			dummy.Model:FindFirstChild("Left Leg").Transparency = 0
			dummy.Model:FindFirstChild("Torso").Transparency = 0
			dummy.Model:FindFirstChild("Head").Transparency = 0
			if dummy.Model:FindFirstChild("Walkie Talkie") then
				dummy.Model:FindFirstChild("Walkie Talkie")["Meshes/untitled"].Transparency = 0
			end

			return
		end

	end

end)

-- Player leaves the game and remove the player from any dummies they are "attached" to
Players.PlayerRemoving:Connect(function(Player)

	-- Loop through all the dummies
	for _, dummy in DummyCharacters do

		-- If the dummy has the player
		if dummy.Player == Player then

			local Humanoid = dummy.Model:FindFirstChildOfClass("Humanoid")

			-- Create new HumanoidDescription
			local NewDescription = Instance.new("HumanoidDescription")

			-- Set all the body colours to Medium Stone Grey
			NewDescription.HeadColor = Color3.fromRGB(163, 162, 165)
			NewDescription.LeftArmColor = Color3.fromRGB(163, 162, 165)
			NewDescription.LeftLegColor = Color3.fromRGB(163, 162, 165)
			NewDescription.RightArmColor = Color3.fromRGB(163, 162, 165)
			NewDescription.RightLegColor = Color3.fromRGB(163, 162, 165)
			NewDescription.TorsoColor = Color3.fromRGB(163, 162, 165)

			-- // Apply the description
			Humanoid:ApplyDescription(NewDescription)
			
			dummy.Model:FindFirstChild("Right Arm").Transparency = 1
			dummy.Model:FindFirstChild("Left Arm").Transparency = 1
			dummy.Model:FindFirstChild("Right Leg").Transparency = 1
			dummy.Model:FindFirstChild("Left Leg").Transparency = 1
			dummy.Model:FindFirstChild("Torso").Transparency = 1
			dummy.Model:FindFirstChild("Head").Transparency = 1
			if dummy.Model:FindFirstChild("Walkie Talkie") then
				dummy.Model:FindFirstChild("Walkie Talkie").Transparency = 1
			end
		end
	end
end)

i cant seem to fix it this is the only problem im running into with this script rn

Hello, have u tried to see if there are any errors in the console tab ( press F9 to see it ). If else then u might have forgot to remove the Player when leaves the game from the dummy table dummy.Player = nil.


i see no errors just warnings

Then u might have forgot to remove the player when leaves from the game. Have u tried to add this line of code on the leave function

Blockquote
dummy.Player = nil

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