I wanted the player to get an item when owning a badge, but it doesn't seem to work?
local badge = game:GetService("BadgeService")
local badgeId = 18987678
local player = game.Players.LocalPlayer
local tool = game.ServerStorage:WaitForChild('BloxyCola')
if badge:UserHasBadge(player.userId, badgeId) then
local newtool = tool:Clone()
newtool.Parent = player.Backpack
else
print("Player doesn't have")
end
This is the error
Workspace.Script:6: attempt to index local 'player' (a nil value)

2 comments
may help to give a slight reasoning behind this answer
Help who? I already explained the reasoning to yoshi in chat, and CodingEvolution explained the rest below (for anyone who comes to this particular post for a reason)