Click Detection Only Working For Activator

So, I’m currently working on making an airlock as just a fun side project because all my other projects are larger and take more time and effort (gotta take breaks sometimes right?). In the older version I was using a tweenservice to move large doors for the entrance but it was fairly laggy and after getting some feedback on that I decided to use local scripts instead of scripts for better performance. Right now its limited to one player per server but I plan on expanding it to several player per server in an Innovation Inc style.

I re-scripted the doors utilizing local scripts but it’s only visible for the player who activated the clickdetector. Is there a way to activate it for the other players as well? It would be nice to have it run smoothly using local scripts.

Basically, I have a click detector and when its clicked It activates a tweenservice but the tweenservice is only visible to the player that clicked it and not visible to other pleyers

Thanks!

Version with scripts (1 player per server)

Version with local scripts (more than 1 player per server, only the first doors opening sequence is in local scripts)

Code (From local script):

local clickdetector = game.Workspace.ControlPanel.Button.ClickDetector
clickdetector.MouseClick:Connect(function()
	local Object = game.Workspace.Door1["13"]
	wait (7)
	local TweenService = game:GetService("TweenService")

	local placementX = Object.Position.X
	local placementY = Object.Position.Y
	local placementZ = Object.Position.Z

	local part = Object
	part.Anchored = true
	part.Parent = game.Workspace

	local goal = {}
	goal.Position = Vector3.new(placementX + -10, placementY, placementZ)


	local tweenInfo = TweenInfo.new(
		10,
		Enum.EasingStyle.Linear
	)

	local tween = TweenService:Create(part, tweenInfo, goal)

	tween:Play()
end)

Yes, it’s messy, I know. Im going to clean it up afterwords.

1 Like

Can you structure your post quickly? I can’t find the problem in all the backstory.
Sorry for any inconvenience!

Im not very good at structuring but I added a simplified version if that helps.

1 Like

Ahh I see.
I know how you want to reduce lag and all, but sadly you will just have to stick with a normal script.
Maybe try to remove some useless/overused parts? I’ll quickly have a look at this airlock right now.

1 Like

Thats a shame. Maybe I should see if I can union some parts together to reduce part count

Also, some feedback for your airlock.

Some of the sound effects don’t fit, like at pressurisation. Use this instead: rbxassetid://926567875

And for the door, you should replace the opening sounds with:
Open: rbxassetid://420909802
Close: rbxassetid://421231359

All and all it’s good.
Also, don’t union parts together, as that won’t reduce any lag. The lag comes from the amount of vertices (or whatever it’s called). Unioning it won’t change anything.

1 Like

Ah alright. Thanks for the sound feedback though! I’ve been looking for better sounds to add. They help a lot.

1 Like

Your welcome!

The only parts I think you can remove that you don’t really need is the lights on the door and the supporting cross in the middle.

You can replace the lights with some smoke and the pressurisation SFX.