Hello! I am trying to make a script when the player dies it clones a certain part in the players position, but it doesn't see to clone. Can anyone help me please?
Here is my current script:
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
local object = game.workspace.Food
humanoid.Died:Connect(function()
print("Humanoid Died")
print(player.Character.Head.Position)
local ClonedObject = object:Clone()
ClonedObject.Parent = workspace
ClonedObject.Name = ("Food")
ClonedObject.Position = player.Character.Head.Position
print("Cloned (Hopefully)")
end)
(If your wondering about the game, Im making a hunger system where the player has to touch the part to eat.) I've thought about instancing the part but its not possible because there is a value inside of it and if many players die the script wouldn't know what part to put the value in.
Sorry if this is a dumb question, kinda new to scripting.

6 comments
Anchor the part.
It is.
is it a model?
nevermind just noticed the comment on the other guys's answer.. also ("Food") looks ugly, try just "Food"
Im not sure if this will work but instead of having the ClonedObject.Parent be the workspace, make it the model in which the body parts of the player are in. So that would be local character probably.
Something else you did wrong was the fact that you did the local for the clone but never actually did "object:Clone()