Alright, so I'm trying to make a script that opens/closes a door depending on what the person says, and what rank in my group they are. Although I've tried to fix it, I just can't. Here's my code:
local staffRankId = 12 local groupId = 5947903 game:GetService("Players").PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if plr:GetRankInGroup(groupId) >= staffRankId then if msg =="/spawn" then game.Workspace.Spawn.CanCollide = false end if msg =="/cspawn" then game.Workspace.Spawn.CanCollide = true end end end)
Thanks in advance.
fix:
local staffRankId = 12 local groupId = 5947903 game:GetService("Players").PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if plr:GetRankInGroup(groupId) >= staffRankId then if msg =="/spawn" then game.Workspace.Spawn.CanCollide = false elseif msg =="/cspawn" then game.Workspace.Spawn.CanCollide = true end end end) end)
You forgot end) on line after the other one. I'm also making your script shorter.