math.randomseed(tick())
script.Parent.Touched:connect(function(hit)
script.Disabled = true
local player = hit.Parent.Name
local random = math.random(1,100)
if random > 0 and random < 50 then
local sword1 = game.ServerStorage.Sword1:Clone()
sword1.Parent = game.Players[player].Backpack
elseif random > 50 and random < 100 then
local sword2 = game.ServerStorage.Sword2:Clone()
sword2.Parent = game.Players[player].Backpack
end
script.Parent:Destroy()
end)
****Error Line 15 and 11

1 comment
Make sure you check that the hit is a player before you use it as one. My guess is that whatever your object touched is parented to the workspace, which doesn't seem to be your intention.