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

How to make it so if a player touches a part then they get kicked?

Asked by 2 years ago

I want to make it so if a player touches a part called Floor then they get kicked but if they own the gamepass they nothing happens.

1 answer

Log in to vote
0
Answered by 2 years ago
local part,debounce,gpid=workspace.VipRooms.Floor,false,1234
local Players,GamePassService=game:GetService"Players",game:GetService"GamePassService"
part.Touched:Connect(function(v)
    if debounce then return end
    debounce=true
    local player=Players:GetPlayerFromCharacter(v.Parent)
    if player and not GamePassService:PlayerHasPass(player,gpid)then
        player:Kick()
    end
    wait(.5)
    debounce=false
end)
Ad

Answer this question