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

How do I make a vip that when they don't have the gamepass it kills them instantly?

Asked by
Falzoon -2
6 years ago

i need it for my roblox minigame

0
Bold magicguy78942 238 — 6y

2 answers

Log in to vote
1
Answered by
waifuSZN 123
6 years ago
Edited 6 years ago

https://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass

https://wiki.roblox.com/index.php?title=API:Class/Humanoid/Health

Set player's health to 0 if this returns false.

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You will want to check if the player has the gamepass using gamepass service https://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass

You will want to check if they touched the door using the .Touched event which is fired when a basepart is touched. https://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched

And to get the player from the character we will use https://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter

Also to kill the player we will use :BreakJoints() since it kills the player. I prefer :BreakJoints() over setting the health to zero since it takes less referencing.

Alright lets get coding.

(In this case we will put the script inside the door instance)

01local gamepassService = game:GetService("GamePassService")
02local players = game:GetService("Players")
03local door = script.Parent
04local gamepassID = 123456789
05local canTouch = true
06 
07local function gamepassCheck(player)
08    if not gamepassService:PlayerHasPass(player, gamepassID) then
09        player.Character:BreakJoints()
10    end
11end
12 
13local function doorTouched(hit)
14    if canTouch then
15        canTouch = false
View all 27 lines...

Make sure to change the gamepass to the ID you are using. (Tell me if the script has any problems.)

Answer this question