I have a problem with my remotefunction to open a door locally (video + scripts)

  1. What do you want to achieve? I would like to make sure that when both players touch their parts then the door opens only for those two players

  2. What is the issue? I created a remote function to open the door as I was advised to do, the script works except that the door opens for all players in the game

  3. What solutions have you tried so far? I tried to modify the scripts, I tried to put the remote function script locally, I tried different things without success. (I am still a beginner)

--ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local opendoor = ReplicatedStorage:WaitForChild("opendoor")
opendoor.OnServerInvoke = function(player)
	game.Workspace.Door2.Transparency = 1 
end

The second script is cut to match just the door opening action, I can send the whole script if needed

--LocalScript in StarterCharacter
local transparent = function()
	if debounce == 1 then
		debounce = 2
		opendoor:InvokeServer(game.Workspace.Door2)
	end
	if not debounce == 1 then end
end;

remote

Thanks !!

Perhaps you understood the advice wrong. Most of the things done in Local Scripts, appear only for player that owns that script. Everything done in server scripts, appear for every player.

So you should fire an event from a server script to a local script, and change the transparency in that local script. You did the opposite. Also you are using remote function, which is unneccessary in this case, you should use a regular remote event. See this page for more information.

1 Like

Thank you I will try to put your advice into practice