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
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.
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â
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)
Exactly, do this and tell me if it worked or not!
What is the fifth line of your script?
there is a colon
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?
Thats right. its a error that tells you to use something like game.Workspace.Zombie for a position.
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â
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
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
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
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.
Try to reposition âa.Position = humRootPart.Positionâ with âa.CFrame = humRootPart.CFrameâ, as Voliiqs said above.
