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

Why won't this work? SOLVED [closed]

Asked by 10 years ago

This script is for a V.I.P Door:

local door = script.Parent

function open()
    -- This function will open the door.
    door.CanCollide = false -- Make players able to walk through the door.

    for transparency = 0, 1, .1 do
        door.Transparency = transparency
        wait(.1)
    end
end

function close()
    -- This function will close the door.
    for transparency = 1, 0, -.1 do
        door.Transparency = transparency
        wait(.1)
    end

    door.CanCollide = true -- Make players unable to walk through the door.
end

-- This function returns the player a certain part belongs to.
function get_player(part)
    --iterate over each player
    for _, player in ipairs(game.Players:GetPlayers()) do
        --if the part is within the player's character 
        if part:IsDescendantOf(player.Character) then
            --return the player
            return player
        end
    end
end


door.Touched:connect(function(part)
    -- If it isn't a character that touched the door, then we ignore it.
    local player = get_player(part)
    if not player then return end

local allow = (
        false
    )
    if allow then
        open()
        delay(4, close)
    end

player:IsInGroup(980953)
end)
0
How do you know it 'doesn't work'? Are there errors? Does it partially behave correctly? BlueTaslem 18071 — 10y
0
Actually never mind. I solved it myself. dlalswo235 0 — 10y

Closed as Not Constructive by BlueTaslem, Shawnyg, and TurboFusion

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?