There’s 2 things that I see, one of them being a probably cause for the issue.
The main issue I see that could be doing that is
while true do wait(1)
giveSword(plr)
end
This code gives the player a sword every second, why did you do it like this? Were you trying to make it work after the player respawns? You can do this instead
giveSword(plr)
plr.CharacterAdded:Connect(function()
giveSword(plr)
end)
(I made the code run when the player is added as well for the first time the player joins, just incase)
The second unrelated thing is that you should never use the 2nd parameter of Instance.new(), it’s slow