Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a script check if you are on a teamby using a Promiximty Prompt?

So, I am trying to make something check if you are a team but its not working it keeps saying that I am not on the team but I am, Could anyone help?

local players = game:GetService("Players")
local Teams = game:GetService("Teams")

script.Parent.Attachment.ProximityPrompt.Triggered:Connect(function(player)
	if player.Team == Teams.engineer then
		script.Parent.Transparency = 0
		script.Parent.Attachment.ProximityPrompt.MaxActivationDistance = 0
	else
		print("Not on team")
	end
end)


2 comments

0

Instead of doing "Teams.engineer" try doing "engineer". I'm not too sure, but that MIGHT work.

0

So, "if player.Team == "engineer" then"

1 answer

✓ Accepted answer

I hopped into studio and messed around with it. What I've done to get this to work is the following

workspace.Part.ProximityPrompt.Triggered:Connect(function(player)
	print('Within distance')
	
	if (player.Team == game:GetService('Teams'):FindFirstChild('Engineer')) then
		print('woohoo!')
	else
		print('Not on team.')
	end
end)

1 comment

0

That literally changed nothing

This discussion is preserved as it was. New answers, comments, and votes are closed.