Team Color Lock

  1. What do you want to achieve? Only Team Player can press.

  2. What is the issue? Saying Error on

if plr.TeamColor == BrickColor.new("Lapis") then
  1. What solutions have you tried so far? Yes but no solutions.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

CLOSE.MouseButton1Click:Connect(function(plr)
	if plr.TeamColor == BrickColor.new("Lapis") then
		CloseTween:Play()

	end
end)

https://gyazo.com/3a4826d93a8a33d5288b5778cd8552a4
Issues.

MouseButton1Click doesn’t return a player, you need to find some other way to get a player, typically via a localscript, which if you do that, you will need to change up how you set things up. You’d need to move the surfaceGui (which I think is what you’re using) into StarterGui, set the Adornee property to the part it should go on and replace your script with a localscript (Most likely putting in the SurfaceGui itself or somewhere else), because then you can do

local Players = game:GetService("Players")

local player = Players.LocalPlayer

To get your player

I am currently making the station home door.
For this I am using the surfacegui for panel to make more realistic.
Also, I am using the script to show everyone that door has opened.
I can use tweenservice with local too?

TweenService can be done locally, but in your case since you want the door to open for everyone, I’d recommend a RemoteEvent approach. You’ll need 2 scripts, a regular one and a local one. The local one detects when you click on the button, which fires the remote event (FireServer) after checking their team color and the regular one should detect when you fired the event (OnServerEvent).

When it detects you tried to open the door, check the TeamColor again for safety and then if they’re the right team, open the door

1 Like

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