script.Parent.MouseButton1Down:Connect(function(hit)
a=script.Parent.Parent.TextBox.Text
b=game.Lighting.Keycard
c=b:Clone() d=Instance.new("IntValue")
c.Parent=hit.Backpack
d.Parent=c
d.Value=a
end)
For some reason this script won't work. Basically when I click a button, its supposed to get the text from the textbox, and then create a keycard with that value, however it doesn't work. It says. The error from below points to the script I have shown in the example however, it does not not help me know what the problem is. The gui IS in the PlayerGUI by the way, not starter gear.
13:43:23.565 - Players.Player1.PlayerGui.ScreenGui.Main.TextButton.Script:5: attempt to index local 'hit' (a number value)

1 comment
Mistake, meant to say StarterGUI