So the thing is that when the player touched the object, it fires the remote event for the client and once fired, a gui will show, Any help?
-- Main Script coded in a Script
local function acti() _G.Wall1.Disabled = false _G.Wall2.Disabled = false game.ReplicatedStorage.RemoteEvent:FireClient() end script.Parent.Touched:Connect(acti)
-- Receiver coded in a Local Script:
local function activateSpook() script.Parent.Enabled = true end game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(activateSpook)
You need to fire a player instance when firing to a specific client. Since Touched event returns hit parameter, and you can use hit.Parent for the character. By using :GetPlayerFromCharacter it returns a player instance for the following character. Replace the line 5 as:
game.ReplicatedStorage.RemoteEvent:FireClient(game:GetService("Players"):GetPlayerFromCharacter(hit.Parent))
Hover over the Lua block and press "Open Source" to view the full lua block! (Since it's too long)
When using
:FireClient()
you have to add a player in the brackets so the computer knows who to fire the event to. Like so:
:FireClient(player)