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

[ANSERWED] Trying to make group door but, script wont work for the door?

Asked by 3 years ago
Edited 3 years ago
local groupID = 11879197
local RankToEnter = 190
local Garage = script.Parent

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(groupID) >= RankToEnter then
    local function ifTouched(GarageFunction)
    if GarageFunction.parent:FindFirstChild('Humanoid') then
        Garage.Transparency = .5
        Garage.CanCollide = false
        wait(5)
        Garage.Transparency = 0
        Garage.CanCollide = true
    else
        print('failed to open garage FORTNITE1_01')
            end
        end
    end
end)

This script is not working!! Help me!

I'm trying to make a group door the will change the cancolide and transparency factor of the door, but the script won't work?

1 answer

Log in to vote
0
Answered by 3 years ago

You can achieve this with collision service by creating a collusion group for the "Garage" and one for the players with the rank like this:


local groupID = 11879197 local RankToEnter = 190 local Garage = script.Parent local PhysicsService = game:GetService("PhysicsService") local playerWithRankGroup = "PlayerWithRankGroup"; local garageGroup = "garageGroup"; PhysicsService:CreateCollisionGroup(playerWithRankGroup) PhysicsService:CreateCollisionGroup(garageGroup) PhysicsService:SetPartCollisionGroup(Garage, garageGroup) function setPlayerGroup(char) for i,v in pairs(char:GetDescendants()) do if (v:IsA("BasePart")) then PhysicsService:SetPartCollisionGroup(v, playerWithRankGroup); end end end game.Players.PlayerAdded:Connect(function(player) if player:GetRankInGroup(groupID) >= RankToEnter then local character = player.Character or player.CharacterAdded:Wait() setPlayerGroup(character) player.CharacterAdded:Connect(function() character = player.Character if character then setPlayerGroup(character) end end) end end) PhysicsService:CollisionGroupSetCollidable(playerWithRankGroup, garageGroup, false)
Ad

Answer this question