I've been trying to make a script to where when a player dies, they drop a block that you can collect to gain credits, whenever somebody dies i get the error "Position is not a valid member of Model" in the output, however I'm only cloning a part and not a group, and the part isn't in a group either. ( Haven't added the part where you can actually walk over it to collect credits yet. )
game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() print(player.Name .. " has died!") local RS = game:GetService("ReplicatedStorage") local drop = RS.CreditsDrop:Clone() drop.Parent = workspace drop.Position = character.Position drop.Anchored = false print("Credits have been dropped") end) end) end)
It said that the model of the character, not the part you are spawning, so i gonna take the position of the character head:
game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() print(player.Name .. " has died!") local RS = game:GetService("ReplicatedStorage") local drop = RS.CreditsDrop:Clone() drop.Parent = workspace drop.Position = character.Head.Position drop.Anchored = false print("Credits have been dropped") end) end) end)