attempt to index number with 'Position'?
Asked by
4 years ago Edited 4 years ago
I feel i am missing out on something and that im being dumb.
Can you fix this error? (On line 35)
(Workspace.Crate Drops.Crate Drop.Handler:35: attempt to index number with 'Position')
02 | HitBox = script.Parent [ "Crate" ] .Hit |
03 | local Remote = script.Parent.Regen |
04 | local Workspace = game:GetService( "Workspace" ) |
05 | HitBox.CFrame = CFrame.new(math.random(- 1024 , 1024 ), 1000 ,math.random(- 1024 , 1024 )) |
08 | local function SpawnItem(POS) |
09 | if math.random( 1 , 2 ) ~ = 1 then |
12 | if math.random( 1 , 4 ) ~ = 1 then |
15 | if math.random( 1 , 8 ) ~ = 1 then |
18 | if math.random( 1 , 16 ) = = 1 then |
26 | local TierFolder = game.ServerStorage.Tools:FindFirstChild( "Tier" ..Tier) |
29 | local Tools = TierFolder:GetChildren() |
30 | local RandomTool = Tools [ math.random( 1 , #Tools) ] |
32 | local ToolClone = RandomTool:Clone() |
33 | ToolClone.Parent = script.Parent |
34 | if ToolClone.Parent = = script.Parent and ToolClone and ToolClone:FindFirstChild( "Handle" ) then |
35 | ToolClone.Handle.Position = POS.Position |
40 | local HUM = PRT.Parent:FindFirstChild( "Humanoid" ) |
41 | local PLR = game.Players:GetPlayerFromCharacter(PRT.Parent) |
43 | local LDR = PLR:FindFirstChild( "leaderstats" ) |
44 | local Points = LDR:WaitForChild( "Points" ) |
45 | local Multi = LDR:WaitForChild( "Multiplier" ) |
46 | local UMulti = LDR:WaitForChild( "UL. Multiplier" ) |
47 | if not HUM or not Points or not Multi or not UMulti then return end |
48 | SpawnItem( 1 , script.Parent.Crate.Position 1 ) |
49 | local function DestroyWeld(Parent) |
50 | for i, v in pairs (Parent:GetChildren()) do |
53 | elseif v:IsA( "Model" ) or v:IsA( "Folder" ) or v:IsA( "BasePart" ) then |
58 | DestroyWeld(HitBox.Parent) |
60 | Multi.Value = UMulti.Value+ 1 *Multi.Value + 0.1 |
61 | Points.Value = Points.Value + math.random( 500 ,Multi.Value+ 1 * 3000 ) |
63 | HitBox.Parent.Parent = game.ServerStorage |
64 | wait(math.random( 30 , 60 )) |
67 | HitBox = script.Parent [ "Crate" ] .Hit |
68 | Touched = HitBox.Touched:Connect(Stuff) |
69 | HitBox.Parent.Parent = script.Parent |
70 | HitBox.CFrame = CFrame.new(math.random(- 1024 , 1024 ), 1000 ,math.random(- 1024 , 1024 )) |
75 | Touched = HitBox.Touched:Connect(Stuff) |
78 | if HitBox.Position.Y > = - 10 then return end |
79 | HitBox.CFrame = CFrame.new(math.random(- 1024 , 1024 ), 1000 ,math.random(- 1024 , 1024 )) |
Thank you, Btw the script is made for a crate supply thingy.