It does nothing, no errors in output either. I'm really not sure why. It's a server script in a part.
local cloneguievent = game:GetService("ReplicatedStorage"):WaitForChild("OldShack1")
local cloneguievent2 = game:GetService("ReplicatedStorage"):WaitForChild("KeyBadge")
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
function onTouch(hit)
if hit then
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plyr = game.Players:FindFirstChild(h.Parent.Name)
--local player = Players:GetPlayerFromCharacter(hit.Parent)
if plyr and BadgeService:UserHasBadgeAsync(plyr.UserId, 2124469351) then
cloneguievent2:FireClient(plyr)
else
cloneguievent:FireClient(plyr)
end
end
wait(0.5)
end
end
script.Parent.Touched:connect(onTouch)

1 comment
this should error acutally, you are doing game.Players:FindFirstChild(h.Parent.Name), while h is actually a part of the charater not player, so yeah. the character doesnt have a userId, and that :GetPlayerFromCharacter is right