I'm sort of new to lua and need some help with this
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
local player = game.Workspace:FindFirstChild("Humanoid")
local teams = game.Teams.Blue
if player then
local player1 = game.players:GetPlayersFromCharacter(hit.Parent)
if player1.Team == teams then
print("The Blue Team Clicked This")
end
end
end)

16 comments
You're looking for a humanoid in the Players service?
You made a mistake posted above ^ change your script
Nope, try reading my code again. I just stuck to his convention for calling the character 'player'. Though I suppose my comment is misleading, I'll edit it.
Reply was to incapaz, what mistake in particular?
incapaz you tell him he made a mistake then if he doesn't do anything you downvote. He is trying to help and only missed the .Character after player. A innocent typo
Wait incapaz! He just used player as a variable meaning the character he didn't make a mistake at all!
incapaz was right I'm sorry
Ahh, ignore my previous comments, I confused the event he used with Touched, haha. Worked with wrong parameters. Will edit post. Thanks for the corrections guys :)
No, the player object itself is passed as a parameter in MouseClick. "hit.Parent" is just the Players service, and saenae is looking for a Humanoid in the Players service.
@OBenjOne don't say stupid stuff. I will remove my downvote once it's removed. It should be edited now.
It's removed.
Sry
It does not work :(
Is it not compiling or is there some other issue?
I have tested it and does not work
Does a folder called 'Teams' exist in your Explorer? If not, try calling game:GetService("Teams") in the code.