Hello, I would like to achieve a client sided script to handle things such as visual effects, animations, and many other things.
Although I have run into an issue. For some odd reason FireAllClients does not work. I have a local script inside of SCS that uses a keybind to fire a remote to a server script, said server script receives the remote and works fine but when I try to fire a remote to the client from said script it won’t print from the client. I have tried from scratch following a tutorial one by one to see if I was doing something wrong but nothing works.
Server Script
local Remotes = game.ReplicatedStorage.Remotes
local RasenganRemote = Remotes.UzumakiCombo
local ClientRemote = Remotes.Client.UzumakiCombo
RasenganRemote.OnServerEvent:Connect(function(player)
print("A") -- Prints
local model -- this is for the hitbox, which I didn't include in this post.
ClientRemote:FireAllClients(player, model)
print("B") -- Prints
end)
Local Script
local Remotes = game.ReplicatedStorage.Remotes
local ClientRemote = Remotes.Client.UzumakiCombo
local rockmod = require(game.ReplicatedStorage.Modules.RockModule)
local mod = require(game.ServerScriptService.RagdollModule)
ClientRemote.OnClientEvent:Connect(function(plr, Enemy)
print(plr) -- doesnt print
print(Enemy) -- doesnt print
print("Uzumaki Combo Client") -- doesnt print
end)
I’ve had this problem for a very long time now. I really wish I could find a fix
The RemoteEvent isn’t detecting any request(s) from the server. This may be due to the server not sending a request to the client, or the client itself is not receiving it with anything.
Make sure the variable(s) which states the ‘RemoteEvent’ is an actual path. Maybe try using :WaitForChild() to make sure everything loads in correctly. e.g:
local Remotes = game.ReplicatedStorage:WaitForChild("Remotes", 100) :: Folder?
This is probably due to the RemoteEvent not loading in time for the LocalScript as it’s replicating itself to clients.
It is generally good practice to use :WaitForChild() when indexing things on the client.
Try this:
local Remotes = game.ReplicatedStorage:WaitForChild("Remotes")
local ClientRemote = Remotes.Client:WaitForChild("UzumakiCombo")
local rockmod = require(game.ReplicatedStorage.Modules:WaitForChild("RockModule"))
local mod = require(game.ServerScriptService.RagdollModule) -- this wouldn't work
ClientRemote.OnClientEvent:Connect(function(plr, Enemy)
print(plr) -- doesnt print
print(Enemy) -- doesnt print
print("Uzumaki Combo Client") -- doesnt print
end)
Assuming this is done on a LocalScript(which should be) RagdollModule wouldn’t work as ServerScriptService is only accessible through the server(normal scripts)
I think that putting a local script inside a ServerScriptService where it is especially for server scripts only may not be a good idea, you might want to parent them (local scripts) in a starter character/player script folder so it can be ran properly in the client side