Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] Part is being classified as a group?

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)

1 answer

✓ Accepted answer

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)

2 comments

0

Oh, Thanks for the help!

0

You're welcome :D don't forget to accept the answer if it helped !

This discussion is preserved as it was. New answers, comments, and votes are closed.