Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to reward players with a badge? [Solved]

Asked by 4 years ago
Edited by Ziffixture 4 years ago

How do i rewards players when time they reach a time limit? (there is a time limit, and it works.)

ERROR: "userId is not a valid member of Part"

local Boards = workspace.Keycard
local door = workspace.Door
local WALL = workspace.BlahBlah
local LOL = workspace.Block




script.Parent.Touched:connect(function(p)
local o = game.Players:GetPlayerFromCharacter(p.Parent)
if p.Parent.Name == "Card" ~= nil then
--insert code here
print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
local b = game:GetService("BadgeService")
b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
wait(2)
workspace.RIP:Stop()
for _,v in pairs(game.Players:GetPlayers()) do
if v:IsA("Player") then
v:Kick("Goodbye Loser")
end 
end
end
end)

Answer this question