Local script works in studio but not in game

this local script is meant to hide a proximity prompt for other teams and should be shown on one team only, works in studio but when i actually play in the real published game, it just shows for everyone

while wait(.001) do
	local plr = game:GetService("Players").LocalPlayer

	if plr.Team == game.Teams["Combine"] then
		workspace.APARTMENTDOORS1.Door.Breach.ProximityPrompt.Enabled = true
	else
		workspace.APARTMENTDOORS1.Door.Breach.ProximityPrompt.Enabled = false
	end
end


1 Like

why are you looping this?
also, check to make sure the teams are loaded in, it’s probably indexing too fast on game.Teams

It’s now saying APARTMENTDOORS1 is not a valid member of the workspace.

Solved! Had to add workspace:WaitForChild

Yeah, even if your solution was already found this code does not need to be looped.
Much better to use a change function then looping this code.
Glad you found your solution though, and we are just trying to help you improve your code!

Bro linked himself as the solution lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.