I've got a server script that puts on a hat if a player clicks the hat, all of the script works perfectly except for the new part that I've added that checks what team the player is on before putting the hat on the player, It outputs no errors, but just does nothing.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("Headlamp") local ClickDetector = script.parent:FindFirstChild("ClickDetector") game.Players.PlayerAdded:Connect(function(Player) print(Player.Name) end) local Teams = game:GetService("Teams") local Hunters = Teams:FindFirstChild("Hunters") ClickDetector.MouseClick:Connect(function(Player) print('ClickRegistered') local Headlamp = script.Parent local Playername = Player.Name print(Playername) local Playeruser = game.Workspace:WaitForChild(Playername) local Humanoid = Playeruser:WaitForChild("Humanoid") if Playeruser:FindFirstChild("Headlamp") == nil then if Playername.Team == Hunters then Humanoid:AddAccessory(Headlamp) remoteEvent:FireClient(Player) end end end)
Could someone tell me why? Thanks!
Player.Name Doesn't have a property called Team. To call the team use this
Player.Team