Unable to cast Instance to int64?

  1. What do you want to achieve? I’m making a thing that gives you a badge when you touch something and I’m using a remote event.

  2. What is the issue? It’s saying this error, I know it means that I’m passing a number where I shouldn’t be, but how do I pass a userid without saying a number lol?

  3. What solutions have you tried so far? A lot

local badgeService = game:GetService("BadgeService")

local Replicated = game:GetService("ReplicatedStorage")
local Event = Replicated:WaitForChild("RagdollEvent")

function Award(id, badgeid) 
	badgeService:AwardBadge(id, badgeid) 
end

Event.OnServerEvent:connect(Award) 
2 Likes

The first parameter passed to a function connected to OnServerEvent is a Player instance. You need to redefine your Award function to have the signature:

function Award (player, id, badgeid)

Reference: RemoteEvent.OnServerEvent (roblox.com)

4 Likes