script.Parent.MouseButton1Click:Connect(function(plr) script.Parent.Parent.Parent.frame2.Visible = false script.Parent.Parent.Parent.frame3.Visible = true wait(1) script.Parent.Parent.Parent.frame3.changeLabel.Text = "Verifying Details..." wait(1.5) script.Parent.Parent.Parent.frame3.changeLabel.Text = "Printing Card..." local tool = game.Lighting.Passport local clone = tool:Clone() clone.Parent = plr.Backpack wait(0.5) script.Parent.Parent.Parent.frame3.changeLabel.Text = "Check-In Complete!" 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:
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.