Hey gamers, I’m attempting to make a script that lets only one team lock and unlock a door, however I keep getting the error attempt to index nil with 'Team'. I have looked for solutions but I can’t find anything helpful.
Here’s the script:
local plr = game:GetService("Players").LocalPlayer
local Teams = game:GetService("Teams")
script.Parent.Triggered:Connect(function()
if script.Parent.Parent.Parent.Opener.ProximityPrompt.Script.open.Value == false then
if plr.Team == Teams["Security"] then
if script.locked.Value == true then
script.locked.Value = false
script.Parent.ActionText = "Lock"
else
script.locked.Value = true
script.Parent.ActionText = "Unock"
end
end
end
end)
oh, right, i completely forgot that LocalPlayer only works in a local script. This is not a local script, but it can’t be. Are there any alternatives I could use?