I am trying to kill a humanoid if they do not have a gamepass, but I cannot seem to find how to get a player id via humanoid
If you're trying to get the Player ID (I'm assuming user id?) I would suggest using GetPlayerFromCharacter
It's pretty simple, first you start with game.Players
followed by :GetPlayerFromCharacter
then followed by parenthesis that are stored with the character. An example script would be:
local part = script.Parent part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) end end)
Once you have the player defined, find the ID by using player.UserId
You can use Touched
event
Place this in the door:
local Door = script.Parent local RequiredId = 9999 -- your gamepass id local Kill = true -- determines if the door can kill function TOUCHED(hit) if hit then if game:GetService("Players"):FindFirstChild(hit.Parent.Name) then -- check if player local player = game:GetService("Players"):FindFirstChild(hit.Parent.Name) if player:IsA("Player") and CHECK_ACCESS(player) then --code elseif Kill then player.Character:BreakJoints() end end end end function CHECK_ACCESS(player) if game:GetService("GamepassService"):PlayerHasPass(player, RequiredId) then return true else return false end end Door.Touched:connect(TOUCHED)