Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[SOLVED] Part is being classified as a group?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
0
Oh, Thanks for the help! SillyDamien 11 — 4y
0
You're welcome :D don't forget to accept the answer if it helped ! Nguyenlegiahung 1091 — 4y
Ad

Answer this question