Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.