I have an issue with my recent script, I’m new to the world of scripting so please just constructive comments. It should perfectly work for me and I don’t see any mistake in the script, what is wrong with it? I’m making something wrong?
Script that should work:
local AllowedToOpenDoorRank = 255
local AllowedOnesGroupId = 6307151
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(AllowedOnesGroupId) >= AllowedToOpenDoorRank then
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message == "!OpenDoor" then
workspace.DahDoor.Door.CanCollide = false
workspace.DahDoor.Door.Transparency = 0.5
end
end)
end)
end
end)
you do not need to have two playeradded events, the cmd will not work already if the player fails the group rank check.
local AllowedToOpenDoorRank = 255
local AllowedOnesGroupId = 6307151
game.Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(AllowedOnesGroupId) >= AllowedToOpenDoorRank then
Player.Chatted:Connect(function(msg)
if msg == "!OpenDoor" then
workspace.DahDoor.Door.CanCollide = false
workspace.DahDoor.Door.Transparency = 0.5
end
end)
end
end)
I did now and it has successfully worked, thank you for solving my issue. But I has to change the “!OpenDoor” part because the (“”) were in another font.