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
This should work, otherwise DM me on discord: A_Mp5#5847
-- local h = :FindFirstChild("Humanoid") (ignore this) --local plyr = game.Players:FindFirstChild(Clicker.Parent.Name) (also ignore this) local clickdetector = script.Parent local bed = script.Parent.Parent clickdetector.MouseClick:Connect(function(Clicker) local plyr = game.Players:FindFirstChild(Clicker.Name) -- if this doesn't work, make it: "Clicker.Parent.Name" if plyr.Team == "Blue" then print("Bed clicked by " .. Clicker.Name..", on"..plyr.Team.."team!") bed:Destroy() end end)