Help! Why doesn't the Apple spawn where the mob was killed

As seen in the video i kill the zombie and the apple is meant to drop where the zombie died but it spawns where it was originally placed on the map

3 Likes

You’re changing to parent of the apple to workspace not the zombie’s position on death, so it would spawn in workspace instead of the place the zombie died.

2 Likes

You have selected the parent of the apple, which is the Workspace, but you have not selected the position where the apple will be applied to in the Workspace. So, as you put the script as parented in the zombie, you will need to put the following under “a.Parent”: “a.Position = script.Parent.Position”

1 Like

So, like this?
function onDied()
wait(2)
local a = game.Lighting[“Chest”]:Clone()
a.Parent = game.a.Parent:
a.Position = script.Parent.Position
script.Parent.Parent:Destroy()
end
script.Parent.Died:Connect(onDied)

1 Like

Exactly, do this and tell me if it worked or not!

Got this;
Workspace.Monster1.Humanoid.Script:5: Expected ‘(’, ‘{’ or when parsing function call, got ‘.’

What is the fifth line of your script?

image there is a colon

1 Like

removed the colon and got
a is not a valid member of DataModel “Baseplate”

What do you mean “game.a.Parent” in “a.Parent = game.a.Parent”? wasn’t it supposed to be the “game.Workspace” instead?

1 Like

Thats right. its a error that tells you to use something like game.Workspace.Zombie for a position.

1 Like

Im so lost now loool,
function onDied()

wait(2)

local a = game.Lighting[“Chest”]:Clone()

a.Parent = game.Workspace.Monster1

a.Position = script.Parent.Position

script.Parent.Parent:Destroy()

end

script.Parent.Died:Connect(onDied)

Position is not a valid member of Humanoid “Workspace.Monster1.Humanoid”

2 Likes

position shouldnt be on human. just torso lol but make it that it falls when it spawns at torso
which its like "after zombie dies. it should be something like this:
game.Workspace.Monster1.Anchored = false

1 Like

Any chance you can re-write it? i have no knowledge in scripting at all i tried to learn from a tutorial on roblox for npc dropping lool

1 Like

later. i have to play with my friend (sorry for off topic)

it’s alright, is it just one line thats wrong or multiple? lol

1 Like

function onDied()

wait(2)

local a = game.Lighting[“Chest”]:Clone()
local humRootPart = script.Parent.Parent:FindFirstChild(“HumanoidRootPart”)

a.Parent = game.Workspace.Monster1
a.Position = humRootPart.Position

script.Parent.Parent:Destroy()

end

script.Parent.Died:Connect(onDied)

Try this one and let me know if it worked.

Replace that with a.CFrame = script.Parent.CFrame

If your apple is a model, use the primary part and create welds.

Position is not a valid member of Tool “Workspace.Monster1.Chest”

Try to reposition “a.Position = humRootPart.Position” with “a.CFrame = humRootPart.CFrame”, as Voliiqs said above.