"Workspace.Wood Crate.Script:14: bad argument #1 (interval is empty)"
01 | local serverStorage = game:GetService( "ServerStorage" ) |
02 | local players = game:GetService( "Players" ) |
03 |
04 | local weapons = serverStorage.Weapons:GetChildren() |
05 |
06 | local loot = script.Parent |
07 | local part = loot.PrimaryPart |
08 |
09 | part.Touched:Connect( function (hit) |
10 | local humanoid = hit.Parent:FindFirstChildOfClass( "Humanoid" ) |
11 | if (humanoid and humanoid.Health > 0 ) then |
12 | local player = players:GetPlayerFromCharacter(hit.Parent) |
13 | local backpack = player:WaitForChild( "Backpack" ) |
14 | local clonedWeapon = weapons [ math.random(#weapons) ] :Clone() |
15 | clonedWeapon.Parent = backpack |
16 | loot:Destroy() |
17 | end |
18 | end ) |
It's now solved. If this happens to you, just make sure the items are in the referenced place. Like I forgot that the weapons are not in the Weapons folder. :)