attempt to index local 'Hit', a nil value?
Asked by
8 years ago Edited 8 years ago
1 | script.Parent.MouseButton 1 Click:connect( function (Hit) |
3 | local p = game.Players:GetPlayerFromCharacter(Hit.Parent):WaitForChild( "Folder" ):WaitForChild( "Buns" ) |
This script is attempting to check if a players "Buns" Value equals more then 2 or is equal to 2.
There is no errors, but it does not function.
1 | script.Parent.MouseButton 1 Click:connect( function (Hit) |
2 | local p = game.Players:GetPlayerFromCharacter(Hit.Parent):WaitForChild( "Folder" ):WaitForChild( "Buns" ) |
This script does error. the only thing removed though is PCALL.
21:25:02.248 - Workspace.Part.SurfaceGui.Frame.Blue Pen.Script:2: attempt to index local 'Hit' (a nil value)
21:25:02.248 - Stack Begin
21:25:02.249 - Script 'Workspace.Part.SurfaceGui.Frame.Blue Pen.Script', Line 2
21:25:02.249 - Stack End
((And yes, The Buns is set to 2.))