01 | script.Parent.MouseButton 1 Click:Connect( function (plr) |
02 | script.Parent.Parent.Parent.frame 2. Visible = false |
03 | script.Parent.Parent.Parent.frame 3. Visible = true |
04 | wait( 1 ) |
05 | script.Parent.Parent.Parent.frame 3. changeLabel.Text = "Verifying Details..." |
06 | wait( 1.5 ) |
07 | script.Parent.Parent.Parent.frame 3. changeLabel.Text = "Printing Card..." |
08 | local tool = game.Lighting.Passport |
09 | local clone = tool:Clone() |
10 | clone.Parent = plr.Backpack |
11 | wait( 0.5 ) |
12 | script.Parent.Parent.Parent.frame 3. changeLabel.Text = "Check-In Complete!" |
13 | end ) |
This script is trying to give a tool to a player, but I don't seem to understand any of it as I get the error: Players.Avia_Adaam.PlayerGui.ScreenGui.frame2.TextButton.Script:10: attempt to index local 'plr' (a nil value), I've tried everything and nothing works.
If it's not already, it should be in a local script. If it's in a local script like it should be, then you can just use:
1 | local plr = game.Players.LocalPlayer |
That way you don't even need to use the "plr" from the function itself, which I'm pretty sure gives nil, because it's a MouseClick function, so it's getting the mouse not the player. Although, I'm new to scripting so don't quote me on that.