This is the script that makes the player being able to open a gui, it is on a part that the player must stand on:

local PressurePlate = script.Parent
local Remote = Instance.new('RemoteEvent', game.ReplicatedStorage)
Remote.Name = "PadPressed"

PressurePlate.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		Remote:FireClient(plr)
    end
end)

This is the script that makes it possible to open a/the gui with "e":

local Remote = game.ReplicatedStorage:WaitForChild("PadPressed")
local plr = game.Players.LocalPlayer

Remote.OnClientEvent:Connect(function()
	plr:GetMouse().KeyDown:Connect(function(K)
		if K == "e" then
			script.Parent.Visible = true
		end
	end)
end)

2 comments

0

make it so you have to be on the pressure plate to press e put them together into 1 script

0

How do I put them together into 1 script, please explain further?