Help to open a door locally with a Remote Event [scripts + video] please

It’s a : not a . For fire client

opendoor:FireClient(player)

Oh yeah… Thank you. But unfortunatly the door still won’t open it’s super weird

Where are the prints getting too?

I’m sorry I didn’t understand your question? The actions are carried out well and the prints appear, everything works until the fireclient

im not sure what you are trying to do, are you trying to make the door open when both players have a wrench and step on a button?

you could try this:
place this in local script in starter character scripts:

-- make the following remote events and put them in ReplicatedStorage
local plr = game.Players.LocalPlayer
local char = script.Parent
local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local boolVal = char.HasWrenchOnButton
local boolVal2 = char.HasWrenchOnButton2
local debounce = false
local debounce2 = false
local debounce3 = false
local debounce4 = false

game.Workspace.Clef.Touched:Connect(function(hit)
     if hit.Parent:FindFirstChild("Humanoid") then
          if hit.Parent:FindFirstChild("ToolHere") and debounce == false then
              RemoteEvent:FireServer(boolVal, char, plr)
              debounce = true
              wait(2)
              debounce = false
          end
    end
end)

game.Workspace.Clef3.Touched:Connect(function(hit)
     if hit.Parent:FindFirstChild("Humanoid") then
          if hit.Parent:FindFirstChild("ToolHere") and debounce2 == false then
              RemoteEvent2:FireServer(boolVal2, char, plr)
              debounce2 = true
              wait(2)
              debounce2 = false
          end
    end
end)

game.Workspace.Clef.TouchEnded:Connect(function(hit)
     if hit.Parent:FindFirstChild("Humanoid") and debounce3 == false then
         RemoteEventOff:FireServer(boolVal, char, plr)
         debounce3 = true
         wait(2)
         debounce3 = false
    end
end)

game.Workspace.Clef3.TouchEnded:Connect(function(hit)
     if hit.Parent:FindFirstChild("Humanoid") and debounce4 == false then
         RemoteEventOff2:FireServer(boolVal, char, plr)
         debounce4 = true
         wait(2)
         debounce4 = false
    end
end)

server script in serverScriptService:

game.Players.PlayerAdded:Connect(function(plr)
      plr.CharacterAdded:Connect(function()
           local boolVal = Instance.new("BoolValue",plr.Character)
           boolVal.Name = "HasWrenchOnButton"
      end)
end)

local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local button1Touched = game.ServerStorage.Button1Touched -- make a BoolValue named this and put it in ServerStorage
local button2Touched = game.ServerStorage.Button2Touched -- make a BoolValue named this and put it in ServerStorage

RemoteEvent.OnServerEvent:Connect(function(boolVal, char, plr)
      boolVal.Value = true
      button1Touched.Value = true
      game.Worskpace.Clef.Material = Enum.Material.Neon

      if button2Touched.Value == true and button1Touched.Value == true then
           game.Workspace.Door2.Transparency = 1
      else
           game.Workspace.Door2.Transparency = 0
      end 
end)

RemoteEvent2.OnServerEvent:Connect(function(boolVal, char, plr)
      boolVal.Value = true
      button2Touched.Value = true
      game.Worskpace.Clef3.Material = Enum.Material.Neon
      
      if button2Touched.Value == true and button1Touched.Value == true then
           game.Workspace.Door2.Transparency = 1
      else
           game.Workspace.Door2.Transparency = 0
      end 
end)

RemoteEventOff.OnServerEvent:Connect(function(boolVal, char, plr)
      boolVal.Value = false
      button1Touched.Value = false
      game.Worskpace.Clef.Material = Enum.Material.Plastic
      
      if button2Touched.Value == true and button1Touched.Value == true then
           game.Workspace.Door2.Transparency = 1
      else
           game.Workspace.Door2.Transparency = 0
      end 
end)

RemoteEventOff2.OnServerEvent:Connect(function(boolVal, char, plr)
      boolVal.Value = false
      button2Touched.Value = false
      game.Worskpace.Clef3.Material = Enum.Material.Plastic
      
      if button2Touched.Value == true and button1Touched.Value == true then
           game.Workspace.Door2.Transparency = 1
      else
           game.Workspace.Door2.Transparency = 0
      end 
end)

First, thank you for taking the time to write all this down to help me. I saw you writing for over 20 minutes I thought you just forgot to close the tab. I didn’t imagine that it was a script like these the solution (which are far too complex scripts for my small level of skills). Unfotunatly nothing work for the moment here is the script :

--Local Script in StarterCharacterScript
local plr = game.Players.LocalPlayer
local char = script.Parent
local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local boolVal = char.HasWrenchOnButton
local boolVal2 = char.HasWrenchOnButton2
local debounce = false
local debounce2 = false
local debounce3 = false
local debounce4 = false

game.Workspace.Clef.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent:FindFirstChild("Wrench2") and debounce == false then
			RemoteEvent:FireServer(boolVal, char, plr)
			debounce = true
			wait(2)
			debounce = false
		end
	end
end)

game.Workspace.Clef3.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent:FindFirstChild("Wrench3") and debounce2 == false then
			RemoteEvent2:FireServer(boolVal2, char, plr)
			debounce2 = true
			wait(2)
			debounce2 = false
		end
	end
end)

game.Workspace.Clef.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce3 == false then
		RemoteEventOff:FireServer(boolVal, char, plr)
		debounce3 = true
		wait(2)
		debounce3 = false
	end
end)

game.Workspace.Clef3.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce4 == false then
		RemoteEventOff2:FireServer(boolVal, char, plr)
		debounce4 = true
		wait(2)
		debounce4 = false
	end
end)
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function()
		local boolVal = Instance.new("BoolValue",plr.Character)
		boolVal.Name = "HasWrenchOnButton"
	end)
end)

local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local button1Touched = game.ServerStorage.Button1Touched
local button2Touched = game.ServerStorage.Button2Touched

RemoteEvent.OnServerEvent:Connect(function(boolVal, char, plr)
	boolVal.Value = true
	button1Touched.Value = true
	game.Worskpace.Clef.Material = Enum.Material.Neon

	if button2Touched.Value == true and button1Touched.Value == true then
		game.Workspace.Door2.Transparency = 1
	else
		game.Workspace.Door2.Transparency = 0
	end 
end)

RemoteEvent2.OnServerEvent:Connect(function(boolVal, char, plr)
	boolVal.Value = true
	button2Touched.Value = true
	game.Worskpace.Clef3.Material = Enum.Material.Neon

	if button2Touched.Value == true and button1Touched.Value == true then
		game.Workspace.Door2.Transparency = 1
	else
		game.Workspace.Door2.Transparency = 0
	end 
end)

RemoteEventOff.OnServerEvent:Connect(function(boolVal, char, plr)
	boolVal.Value = false
	button1Touched.Value = false
	game.Worskpace.Clef.Material = Enum.Material.Plastic

	if button2Touched.Value == true and button1Touched.Value == true then
		game.Workspace.Door2.Transparency = 1
	else
		game.Workspace.Door2.Transparency = 0
	end 
end)

RemoteEventOff2.OnServerEvent:Connect(function(boolVal, char, plr)
	boolVal.Value = false
	button2Touched.Value = false
	game.Worskpace.Clef3.Material = Enum.Material.Plastic

	if button2Touched.Value == true and button1Touched.Value == true then
		game.Workspace.Door2.Transparency = 1
	else
		game.Workspace.Door2.Transparency = 0
	end 
end)

c

For the moment even the parts don’t turn into neon when I pass over them with the tools, I keep looking to see if I made a mistake somewhere

1 Like

im confused on what you are trying to do here, could you explain?
what im thinking is that you want to have a door open whenever 2 players have the correct tool and are standing on a platform

im not sure if i have gotten the names right, have you found any errors in the output?

Yes I want that when a player touch the part, the part light up (neon), when the two parts are touched by a different player and are thus in neon, then the door opens only for these two players there. I’m trying to check if I made a mistake in the names, but for the moment nothing happens. No errors in the scripts

yes but im not sure if you want the player to hold the tool while standing on the platform for it to work because i saw in the video you were doing just that

if not, then just replace the local script with this:

--Local Script in StarterCharacterScript
local plr = game.Players.LocalPlayer
local char = script.Parent
local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local boolVal = char.HasWrenchOnButton
local boolVal2 = char.HasWrenchOnButton2
local debounce = false
local debounce2 = false
local debounce3 = false
local debounce4 = false

game.Workspace.Clef.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
			RemoteEvent:FireServer(boolVal, char, plr)
			debounce = true
			wait(2)
			debounce = false
	end
end)

game.Workspace.Clef3.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce2 == false then then
			RemoteEvent2:FireServer(boolVal2, char, plr)
			debounce2 = true
			wait(2)
			debounce2 = false
	end
end)

game.Workspace.Clef.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce3 == false then
		RemoteEventOff:FireServer(boolVal, char, plr)
		debounce3 = true
		wait(2)
		debounce3 = false
	end
end)

game.Workspace.Clef3.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce4 == false then
		RemoteEventOff2:FireServer(boolVal, char, plr)
		debounce4 = true
		wait(2)
		debounce4 = false
	end
end)

Yes yes this is what i want to do. But nothing happened, but i saw that you edited your first post, maybe there is something i forgot to add for the script work

there are 2 tools correct? what are the names of the tools?
im also not sure if you want both tools to work on both buttons, or if you want only 1 specific tool to work on 1 specific button

the name of the tools is Wrench2 and Wrench3, and yes each tool must work for its own part, Clef for Wrench2 and Clef3 for Wrench3

are you equipping the tools? i have gotten the names right
try putting a print like these and tell me if they print anything:

--Local Script in StarterCharacterScript
local plr = game.Players.LocalPlayer
local char = script.Parent
local RemoteEvent = game.ReplicatedStorage.HasWrenchOnButton
local RemoteEvent2 = game.ReplicatedStorage.HasWrenchOnButton2
local RemoteEventOff = game.ReplicatedStorage.HasWrenchOffButton
local RemoteEventOff2 = game.ReplicatedStorage.HasWrenchOffButton2
local boolVal = char.HasWrenchOnButton
local boolVal2 = char.HasWrenchOnButton2
local debounce = false
local debounce2 = false
local debounce3 = false
local debounce4 = false

game.Workspace.Clef.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
         print("player touched clef1")
		if hit.Parent:FindFirstChild("Wrench2") and debounce == false then
             print("player has wrench3 equipped")
			RemoteEvent:FireServer(boolVal, char, plr)
			debounce = true
			wait(2)
			debounce = false
		end
	end
end)

game.Workspace.Clef3.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
        print("hum touched for clef3")
		if hit.Parent:FindFirstChild("Wrench3") and debounce2 == false then
             print("player has wrench3 equipped")
			RemoteEvent2:FireServer(boolVal2, char, plr)
			debounce2 = true
			wait(2)
			debounce2 = false
		end
	end
end)

game.Workspace.Clef.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce3 == false then
		RemoteEventOff:FireServer(boolVal, char, plr)
		debounce3 = true
		wait(2)
		debounce3 = false
	end
end)

game.Workspace.Clef3.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce4 == false then
		RemoteEventOff2:FireServer(boolVal, char, plr)
		debounce4 = true
		wait(2)
		debounce4 = false
	end
end)
1 Like

Yes, the tools are well equipped and functional, nothing is printed in the the output

what are the names for the platforms the players stand on? i may have gotten that wrong

No, I made the necessary small changes. The parts to be touched are “Clef” and “Clef3” and the parts that turn into Neon are “Clefv” and “Clefv3” but I already made the modifications

Capture

c

if nothing is printed in the output, that means the script isnt catching onto when the platform is touched by a player. is the script in starter player scripts?

1 Like

Yes local Script in StarterCharacterScript