Backstory: I am trying to make a group door in my game that uses an open/close script like this (it does work):
local isOpen = false
function Open()
workspace.Door.door.Transparency=(0.7)
workspace.Door.door.CanCollide=false
workspace.Door.window.CanCollide=false
workspace.Door.caution.CanCollide=false
workspace.Door.caution.Transparency=(0.7)
wait(0.9)
isOpen = true
workspace.Door.door.Transparency=(0)
workspace.Door.door.CanCollide=true
workspace.Door.window.CanCollide=true
workspace.Door.caution.CanCollide=true
workspace.Door.caution.Transparency=(0)
isOpen = false
end
workspace.Door.sensor.Touched:Connect(Open)
Problem: I have tested the group door script in my door many times, and it is obvious that it stops around line 9. The Lua debugger has shown no issues with the script whatsoever, and I can't figure out what's wrong with it. The main thing I need to figure out is how to get the Player.Name to a variable that can be used on Line 9. Here is the script:
local isOpen = false
local playerName = ""
script.Parent.Touched:Connect(function(hit)
local player=game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
if player then
playerName = (player.Name)
print(player.Name)
if game.Players[playerName]:IsInGroup(289530) == true then
workspace.gDoor.door.Transparency=(0.7)
workspace.gDoor.door.CanCollide=false
workspace.gDoor.window.CanCollide=false
workspace.gDoor.caution.CanCollide=false
workspace.gDoor.caution.Transparency=(0.7)
wait(0.9)
isOpen = true
workspace.gDoor.door.Transparency=(0)
workspace.gDoor.door.CanCollide=true
workspace.gDoor.window.CanCollide=true
workspace.gDoor.caution.CanCollide=true
workspace.gDoor.caution.Transparency=(0)
isOpen = false
end
end
end)
