Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I've got a problem with Remote Event. Any help?

Asked by 4 years ago
Edited 4 years ago

Hi! I have a problem with making a remote function event. I did a script that fires the event when I touch the brick: (located in ServerScriptService)

local event = game.ReplicatedStorage.RemoteEvent

workspace.Part.Touched:Connect(function()
    event:FireAllClients()
    print("serverWorks")
end)

and the OnClientEvent LOCAL script

local event = game.ReplicatedStorage.RemoteEvent

event.OnClientEvent:Connect(function()
    print("clientWorks")
end)

The problem is that it only prints "serverWorks"

Thank you for every answer :]

0
Is that both the complete scripts ? VerdommeMan 1479 — 4y
0
yeah IzaXD123456 21 — 4y
0
Where is the localscript located? rabbi99 714 — 4y
0
Its in the workspace IzaXD123456 21 — 4y
0
try putting the localscript in starterplayer scripts sean_thecoolman 189 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

LocalScripts cannot run in workspace. They can run only in player's backpack, player's character, PlayerGui, PlayerScripts and a ReplicatedFirst Service

So try putting it inside starterplayer scripts or playergui, and then it should work.

Ad

Answer this question