I Am New To Scripting In Roblox And I Want To Detect What Team A Player Is On When A Model Is Clicked.
I Have Tried Many Methods But None Work. Here Is My Script:
local clickdetector = script.Parent
local bed = script.Parent.Parent
clickdetector.MouseClick:Connect(function(Clicker)
if Clicker.Team == "Blue" then
print("bed clicked by " .. Clicker.Name)
bed:Destroy()
end
end)
pls help

2 comments
i would recommend using
game:GetService("Players"):GetPlayerFromCharacter(Clicker)as the "plyr" (since display names are coming soon and it might tamper with the real username and fake username)I fixed this problem it was just because i was switching teams with a localscript