Code: server:
script.Parent.Triggered:Connect(function(player) game.ReplicatedStorage.Open:FireAllClients() print("A") end)
Client:
game.ReplicatedStorage.Open.OnClientEvent:Connect(function() print("B") openDoor() end)
Output: A (no B)
When it comes to using the :FireAllClients()
feature... I would only use that when you're trying to call to a LocalScript inside of StarterGui/StarterPlayerScripts/StarterCharacterScripts. That's my recommendation but use it as you believe fits. Here's a link that will lead you to how the FireAllClients command works.
The error in your script is the script.Parent.Triggered:Connect
, after reviewing the script; I realized I missed this MASSIVE mistake. What you need to do is changed Triggered
to Touched
.
script.Parent.Touched:Connect(function(player) game.ReplicatedStorage.Open:FireAllClients() print("A") end)
Do note that this command may not work if the LocalScript is in workspace, ReplicatedStorage, ReplicatedScriptService, ServerScriptService and ServerStorage.
game.ReplicatedStorage.Open.OnClientEvent:Connect(function() print("B") openDoor() end)
As explained in my comment above...
Server Script
script.Parent.Touched:Connect(function(player) --not Triggered game.ReplicatedStorage.Open:FireAllClients() print("A") end)
Local Script
game.ReplicatedStorage.Open.OnClientEvent:Connect(function() print("B") openDoor() --im assuming you have this function defined somewhere end)