Hey everyone!
I have been recently working on a sandbox game where you can kill a bunch of dummies with different weapons. As I don’t want to have a system that respawns the dummies automatically. I have made a “Reset Dummies” button. The button removes dummies from the Workspace
and gets another set from ReplicatedStorage
which is cloned there. However, when the dummies are cloned into Workspace
, they cannot be killed in any way without showing any errors in the Output
.
The LocalScript of the button
local button = script.Parent
local Storage = game.ReplicatedStorage
local dummies = Storage.Dummies
button.MouseButton1Down:Connect(function()
for i, v in ipairs(workspace:GetDescendants()) do
if v.Name == "Dummy" then
v:Destroy()
end
end
task.wait(3)
for i, v in ipairs(Storage:GetDescendants()) do
if v.Name == "Dummy" then
local clone = v:Clone()
clone.Parent = workspace.Dummies
end
end
end)
Any ideas on what may be wrong?
If you would like a clarification or anything else in order to fix the problem. Do not hesitate to ask me.