Hello, I am making a cafe type game and I want to make it so only people in my group can go through a door to serve people. If you could tell me how to do this, that would be great!
Similar to what 2011esque said, You can check if a player is in that group. And use Collision Groups to specify if the player can go through that door or not.
I am a new developer I donβt know how to code this all is what Iβm saying.
Take a look through there
How to Check Player in Group:
How to check Player is in Group Rank:
Collison Groups
Physics Service
You can just Use all of these, to combine into a script
Hello,
make sure it script
local Door = script.Parent ------ the Door
local id = 3514227 ----- the Group Id
game.Players.PlayerAdded:Connect(function(player)
if player:IsInGroup(id) then
Door.Transparency = 1
Door.CanCollide = true
end
end)
here for player Player | Documentation - Roblox Creator Hub
here for part Part | Documentation - Roblox Creator Hub
local groupId = 0 --insert Group ID here
script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:findFirstChild("Humanoid")
if hum then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player:IsInGroup(groupId)
script.Parent.Transparency = 0.8
script.Parent.CanCollide = false
wait(1)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end
end
end)
You can change transparency and wait
Example: script.Parent.Transparency = 5
If you want a certain rank to go in the group, simply do:
local GroupId = -- id of your group
game.Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(GroupId) > 2 then --[[ is larger then "2" rank in group then/
alternatively you can do "==" just to get one rank]]
print("door has opened")
-- other stuff
end
end)
I will try all of these scripts.
make sure it script
30 char