Help with group door

Hi there, thank you for going through my post.

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)

Workspace that the script refers:

The script is referring to a group > part of it > property and the script is located at ServerScriptService.

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)

This script may work

1 Like


https://gyazo.com/ca76491af8eaccd9968e6536e19a3410 | It doesn’t work. ;(

That is saying that you forgot to add a end to close of the if statement at line 4.

i tried to rewrite the script a bit cause i dont see the issue with it, are you sure u posted the whole script?

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.