Script works for everyone on the server. (Touched:Connect() problem)

Hello developers!

I’m creating game similiar to speedman and when someone hits finish line then everyone’s shoes destroys and the player who hit finish line gets their points.

Here is script:

for i, EndPart in pairs(Worlds:GetDescendants()) do
			if EndPart.Name == "EndHitbox" then
				EndPart.Touched:Connect(function(hit)
					local hum = hit.Parent:WaitForChild("Humanoid")
					if hum then
						local plrShoe = Players:GetPlayerFromCharacter(hit.Parent)
						if plrShoe and shoes and shoes:FindFirstChild("Energy") then
							if MPS:UserOwnsGamePassAsync(plrShoe.UserId, VipPassId) then
								plrShoe.leaderstats.Energy.Value += shoes.Energy.Value * plrShoe.Rebirth.EnergyR.Value * 1.25 * plrShoe.ValuesFolder.Multiplier1.Value
								plrShoe.LvlFolder.Xp.Value += shoes.XP.Value * 1.5
							else
								plrShoe.leaderstats.Energy.Value += shoes.Energy.Value * plrShoe.Rebirth.EnergyR.Value * plrShoe.ValuesFolder.Multiplier1.Value
								plrShoe.LvlFolder.Xp.Value += shoes.XP.Value
							end
							shoes:Destroy()
							hum.WalkSpeed = 16
							Equiped_Shoes = 0
						end
					end
					
				end)
			end
		end

I’m guess this is the variable for all the players shoes, try to use plrShoe instead of shoe. plrShoe:Destroy()

Can you show the full script? not all variables are shown

What do u want, do u want that all Shoes should be destroyed or from the Winner or losers?

are you sure its deleting every shoe? did you test it with a friend or someone?

I will write u a script now, wait a few min

So, the script will not work because u trying to Destroy the Shoe in the Server, what will not work, u can send a RemoteEvent to the Client and Destroy the Shoe from there. If u need the script tell me.

Edit: I just saw the shoe is inside the character, i will check it again