So basically, the Sword is not being destroyed from player's I don't get any kind of errors, anyone knows what am I doing wrong?
local playersPlaying = require(game.ReplicatedStorage.playersPlaying)
local Sword = game.ReplicatedStorage.Tools.Sword:Clone()
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Visible = false
for i, v in ipairs(playersPlaying) do
local didPlayerUseSword = Instance.new("BoolValue")
didPlayerUseSword.Name = "didPlayerUseSword"
didPlayerUseSword.Value = false
didPlayerUseSword.Parent = v
end
for i, v in ipairs(playersPlaying) do
Sword.Parent = v.Backpack
v.Backpack.Sword.Activated:Connect(function()
v.didPlayerUseSword.Value = true
end)
end
wait(5)
script.Parent.Parent.Parent.Visible = true
for i, v in pairs(playersPlaying) do
--KILL PLAYER
if v.didPlayerUseSword.Value == false then
v.Character.Humanoid.Health = 0
table.remove(playersPlaying, i)
end
print(v.Name.." Clicked The Tool")
for i, v in pairs(playersPlaying) do
local sword = v.Backpack:FindFirstChild("Sword")
if sword then
sword:Destroy()
end
end
end
end)

1 comment
The Sword was located on the character, It was silly of me, I didn't think about it, Thanks!