Weirdest error of all time, "attempt to index upvalue 'player'(a nil value)?
I have a GUI that gives a player a tool but it cant do it with FE on so I decided to use a RemoteEvent to trigger it and then give it to the player.
Here is the script(Located unter ServerScriptService)
1 | local replicatedstorage = game:GetService( "ReplicatedStorage" ) |
2 | local givetool = replicatedstorage:WaitForChild( "RemoteEvent" ) |
3 | local player = game.Players.LocalPlayer |
5 | givetool.OnServerEvent:connect( function () |
6 | local weapon 1 = replicatedstorage:WaitForChild( "Thompson" ) |
7 | weapon 1 :Clone().Parent = player.Backpack |
8 | weapon 1 :Clone().Parent = player.StarterGear |
Here is the local script (Located under StarterGui.SurfaceGUI)
1 | local replicatedstorage = game:GetService( "ReplicatedStorage" ) |
2 | local givetool = replicatedstorage:WaitForChild( "RemoteEvent" ) |
3 | local button = script.Parent:WaitForChild( "Play" ) |
5 | button.MouseButton 1 Click:connect( function () |
The local script fires after pressing a button and then it triggers but it errors where it says "weapon1:Clone().Parent = player.Backpack. It says basically cant upvote player because its a nil value.