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

How to at a player head light with a gamepass?

Asked by 9 years ago

Player will get a point light in their head, but only player who bought the gamepass! Whats wrong? Thanks

gmps = game:GetService("GamePassService");

id = script:WaitForChild("GamePassID");

game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
if gmps:PlayerHasPass(Player , id.Value) then
coroutine.resume(coroutine.create(function()
function Effect(chara)
     head = chara:findFirstChild("Head")
     torso = chara:findFirstChild("Torso")
    for k,v in pairs(head:GetChildren()) do
        if v:IsA("Light") then
            v:Destroy()
        end
    end
    if not head or not torso then return end
     point = Instance.new("PointLight",head)
    point.Range = 15 
    point.Color = Color3.new(255,255,255) 
    point.Brightness = 5 

end

function HookPlayer(plr)
    if plr.Character then Effect(plr.Character) end
    plr.CharacterAdded:connect(Effect)
end
end)

Answer this question