How do I fix Sorry, badges can only be awarded by Roblox game servers

Hello,
I get this Error message when i should get a badge: “Sorry, badges can only be awarded by Roblox game servers” and I wont get the badge because of it. All the other badges worked but only this specific one doesn’t. Does anyone know what it means?
Here is the code if it matters:

local Player=game.Players.LocalPlayer

script.Parent.Activated:Connect(function(player)
	if script.Parent.Name == "CheeseBurger" then
		wait(5)
				
		local BadgeService = game:GetService("BadgeService")
	    local BadgeId = 2153649067

		BadgeService:AwardBadge(Player.UserId, BadgeId)
		Player.PlayerGui.MoneyGUI:Destroy()
		Player.PlayerGui.ChezburgurEnding.Enabled = true
		script.Parent:Destroy()
	end
end)

Any help is appreciated!

1 Like

If you’re using a LocalScript try opt for a Script instead.

1 Like

how do i get the player on a normal script

Looks like it was made in a LocalScript like @optimizedcoder said. What you can do is use remotes depending on what is used.

Remotes will help Local Scripts and Server Scripts communicate with each other. Add one with the name of your choice, and make the server script be able to detect when it is called.

This should help you https://create.roblox.com/docs/scripting/events/remote

1 Like

In the script you seem to have two variables that reference to a player, one called “Player” and another one called “player” which you get from the script.Parent.Activated event, just reference that player instead and switch to a server script.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.