generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Making a vip-only seat? (From group ranks)

Previous Thread :: Next Thread 
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 12:10 PM
How could I do this? What I need to do is make a seat that only people in a certain rank of a group can sit in. Is this possible?


what siggy
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
21 Jun 2015 12:12 PM
Yes.
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 12:13 PM
How would I do this :/


what siggy
Report Abuse
distalDigitPhalanx is not online. distalDigitPhalanx
Joined: 25 Jan 2015
Total Posts: 1509
21 Jun 2015 12:17 PM
Seats are really just parts, except when you touch them, your character is welded to it. Instead of using real seats, make some fake ones. Inside them should be a script that fires a function when the seat is touched. If the touching part belongs to a players' character, and that player is VIP, create a weld between the two.
Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 12:18 PM
thanks


what siggy
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
21 Jun 2015 12:20 PM
local VIPIds = {
123,
456
}

local seat = script.Parent

function isVip(player)
for i,v in next, VIPIds do
if player.userId == v then
return true
end
end
return false
end

function getCharacterDescendant(instance)
while instance and instance.ClassName ~= "Workspace" and instance.ClassName ~= "Model" do
instance = instance.Parent
end

return instance.ClassName == "Model" and instance
end

function seatChanged(property)
if property == "Occupant" then
local character = getCharacterDescendant(seat.Occupant)
local player = game.Players:GetPlayerFromCharacter(character)

if player and not isVip(player) then
character:BreakJoints()
end
end
end
Report Abuse
jordanNin64 is not online. jordanNin64
Joined: 07 Jun 2013
Total Posts: 2457
21 Jun 2015 12:20 PM
Im not sure if there's a way to access group ranks through scripts. One thing you could do is give everyone an intvalue, and number each player according to their rank (1 being leader, 2 being vice leader, etc)

i think your script would probably look something like this:

local script.parent.seat = seat

seat.OnTouched:connect(function(sit)
local hum = sit.parent:FindFirstChild("Humanoid")
if hum then
if hum (is NOT in certain rank then)
seat.Disabled = true


Report Abuse
isc88 is not online. isc88
Joined: 30 May 2013
Total Posts: 27545
21 Jun 2015 12:22 PM
@nq
But that's not checking if the player is in a rank, that's just getting their IDs.
It will work though, thank you.


what siggy
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
21 Jun 2015 12:23 PM
To get a player's rank in a script you can just do Player:GetRankInGroup(int GroupId)
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
21 Jun 2015 12:24 PM
This works with Rank.


local GroupId = 0
local RankNeeded = 255 -- Must be this rank or above to use the seat

local seat = script.Parent

function canUseSeat(player)
if player:GetRankInGroup(GroupId) >= RankNeeded then
return true
end
return false
end

function getCharacterDescendant(instance)
while instance and instance.ClassName ~= "Workspace" and instance.ClassName ~= "Model" do
instance = instance.Parent
end

return instance.ClassName == "Model" and instance
end

function seatChanged(property)
if property == "Occupant" then
local character = getCharacterDescendant(seat.Occupant)
local player = game.Players:GetPlayerFromCharacter(character)

if player and not canUseSeat(player) then
character:BreakJoints()
end
end
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image