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

"player is not on construction" when i am on construction?

hi i am trying to make a streetlight that you can remove the light brick from but if i am on construction it still says player is not on construction

local clickdetecter = script.Parent:WaitForChild("ClickDetector")
local Team = game:GetService("Teams")--["Construction"]
local function onMouseClick(player)
	print('player who clicked is ' .. player.Name)
	if script.Parent.broken.Value == true then
		if player.Team == Construction then
			print("player is on construction")
		else
			print("player is not on construction")
		end
	else
		print("light is not broken")
	end
end

clickdetecter.MouseClick:Connect(onMouseClick)

2 answers

✓ Accepted answer

Try using this script:

local ClickDetector = script.Parent:WaitForChild("ClickDetector")
local Team = game:GetService("Teams")[Construction]

local function onMouseClick(player)
	print('player who clicked is ' .. player.Name)
	if script.Parent.broken.Value == true then
		if player.Team == Team then -- Instead of using a string called "Construction", consider changing it to "Team" where you located before.
			print("player is on construction")
		else
			print("player is not on construction")
		end
	else
		print("light is not broken")
	end
end

ClickDetector.MouseClick:Connect(OnMouseClick)

2 comments

0

that worked thank you

0

No problem!

local Team = game:GetService("Teams"):WaitForChild"Construction"

1 comment

0

i tried that but it did'nt work

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