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

Would someone help me create a simple CanCollide script for a door?

Asked by 6 years ago

Hi there! I'm looking for a script that will perform the following functions if anyone could please help me out:

• A brick that can be clicked with your mouse. The default position is that CanCollide is true. After clicking, CanCollide is false. The brick can be clicked again to make it CanCollide true again. • Only the people with the group id's of 2534270 (BUT, the "Suspended" rank in this group CANNOT open this door) and 2533427. No one else can open the door. • When CanCollide is true, the brick is not transparent. When CanCollide is false, the brick is transparent partially.

I'm not at all good when it comes to scripting so my requests in the future will be very basic lol. Thanks in advance to those that respond! :)

-Terence

0
ScriptingHelpers is not a request site.... DatOneRandomDude 69 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

make sure click detector is in the door, as well as a script. (edited) try it now.

local groupId = 2534270
local suspended = 000 - - change to the RANK of the ROLE you don’t want to click.

script.Parent.ClickDetector.MouseClick:Connect(function(plr) —plr who clicked 
    if plr:GetRankInGroup(groupId) ~= suspended then
        if script.Parent.CanCollide == true and script.Parent.Transparency  ~= 0.5 then
            script.Parent.CanCollide = false
            script.Parent.Transparency = 0.5
        elseif script.Parent.CanCollide == false and script.Parent.Transparency  ~= 0 then
            script.Parent.CanCollide = true
            script.Parent.Transparency = 0
        end
    end
end)
Ad

Answer this question