I can't get this script to work. Is there something that I typed wrong in it?
local door = script.Parent
function open() -- This Function will make the door open.
door.CanCollide = false -- Makes players able to walk through 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 -- Makes players unable to walk through door
end
function get_player(part) -- This function returns the player a certain part belongs too.
for _, player in ipairs(game.Player:GetPlayers()) do -- iterate over player
if part:IsDescendantOf(player.Character) then -- If the part is within the player's character
return player -- return the player
end
end
end
door.Touched:connect(function(part) -- If it isn't a character that touch the door, then we will ignore it.
local player = get_player(part)
if not player then return end
local allow = (game.CreatorId == player.userID)
if allow then
open()
delay(4, close)
end
end)
Guys please help!

1 comment
I found that i the local allow part I had Id as ID but that still didn't fix it.