#Why doesnt the drop weapon system work?
91 messages · Page 1 of 1 (latest)
the script is meant to clone a replica of an tool when they die, this script doesnt do that
like an output error
send the place file if you may
why
script is there
i told u why it doesnt work
now help me find out why it isnt working please
so that i can narrow it down easier
looks alright on the surface
but there could be other factors
does the original tool get destroyed correctly?
show me the code for the npcs? what's the difference?
as in npcs death code for the same feature
one second
this the code for when the nmpc dies
dont mind the hp part
thats for healing the player when they kill an npc
okay
just after parenting the replica
like i said the npc script works perfectly
its just when the player dies with a tool it doesnt create a replica
print what the parent of the replica is
and i mean in the original code, not npc code
what for players?
yeah
my bad
no prob bob
it prints out
so it does set the parent to workspace
but when i go back to where i died theres no replica
check the explorer - it ought to show up there when you die
maybe just a positioning issue
OH
sorry, just worked it out
you set the Y position to 5
oo okay
ohh
huh
stil doesnt work
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
if not rootPart then return end
humanoid.Died:Connect(function()
local posX, posY, posZ = rootPart.Position.X, rootPart.Position.Y, rootPart.Position.Z
local tool = character:FindFirstChildOfClass("Tool") or player.Backpack:FindFirstChildOfClass("Tool")
if tool then
tool:Destroy()
local replica = game.ReplicatedStorage.PlaceholderReplica:Clone()
for _, part in ipairs(replica:GetDescendants()) do
if part:IsA("BasePart") or part:IsA("MeshPart") then
part.CanCollide = true
part.Massless = false
end
end
replica:SetPrimaryPartCFrame(CFrame.new(posX, posY + 5, posZ))
replica.Parent = workspace
print("works")
end
end)
end)
end)
also the replica doesnt appear in workspace in the explorer
@rare stirrup
hi was getting food
hmm
if it's not too big, sending it would help me debug it :) but no worries if you dont want to
weird that it doesnt appear in the explorer if it prints the parent, assuming you did test that
yep
** You are now Level 6! **
also i tried printing out the posx y and z and i got this
so it is ercording the positions
but not cloning for some reason
OH
yeah
its tracking the position of the root part when it's spawned
not when the character dies
yep
☹️
hi
hello
honestly im not sure what else i can help with without the place file, it looks as if it ought to be working