Remote event only work sometimes

Hello, I got a problem with a remote event. The remote Event is firing correctly. But local script where the event is received, doesn’t work. I put some print to see what is wrong, and all the variable are good, but when it comes to the event, it doesn’t work anymore. I really don’t know what to do please help me.

--this is the server script
--all the variable are correct
TransformEvent.OnServerEvent:Connect(function(player)
	player.Character.Torso.Anchored = true	
	CAMCOLOSSALBOX:FireClient(player)
	print("COLOSSAL BOX EVENT FIRED (SERVER)")
end)
--this is the local script
local camera = workspace.CurrentCamera
local ColossalBoxEvent = game.ReplicatedStorage.Event.BoxCamera
local ColossalCamsEvent = game.ReplicatedStorage.Event.ColossalCamEvent
local player = game.Players.LocalPlayer

local path = game:GetService("SoundService"):WaitForChild("Path"):Clone()

local bbox = workspace.Blackbox
local rig = bbox.Rig
local camerapartbox = bbox.CamColossal

local UI = script.Parent
local Top = UI.TopLine
local Bottom = UI.BottomLine
local bscreen = UI.BlackScreen

local TweenService = game:GetService("TweenService")
local T1 = TweenInfo.new(.5, Enum.EasingStyle.Linear)
local T2 = TweenInfo.new(1.5, Enum.EasingStyle.Linear)
local g1 = {BackgroundTransparency = 0}
local g2 = {BackgroundTransparency = 1}

local RP = game:GetService("ReplicatedStorage")
local TransformEvent = RP.Shifter.Colossal.ColossalTransform

local Players = game:GetService("Players")

local RigEvent = game.ReplicatedStorage.Event.RigEvent

local bgui = game.StarterGui.BillboardGui:Clone()


ColossalBoxEvent.OnClientEvent:Connect(function()
	print("COLOSSAL BOX EVENT FIRED (LOCAL)") --this thing only print sometimes, and the rest of the script only work sometimes
end)

in the output:
COLOSSAL BOX EVENT FIRED (SERVER)

Please help!

8 Likes

You’re going from client to server to client, why not just do all the client stuff at once then fire the server too?

If you want the local scripts separate, look into bindable events. No need for two remotes unless something needs to be done on the server before the client continues, which if that’s the case, you could just use a remote function, which is basically a remote event that requires a response back to the side that fired it.

5 Likes

I’ll use bindable event and I’ll tell you if it works.

5 Likes

Bindable event didn’t work, and I don’t know how to use remote function, I looked on yt and on the forum, but I can’t figure out how I can introduce remote function into my scripts, because my script need to continue to run at the same time as my local scripts, but remote function need a response back to continue ? so my script will not continue to run?
To be honest I don’t think I understood how to use it.
Thanks for your help!

4 Likes

Remote functions do need to respond back for the other scripts to continue running, but I thought you were using remote events? If you aren’t already, try to use remote events. They allow the other scripts to continue running without waiting for a response back.

1 Like

Yes I use remote event, but if I use remote function my script will not run together ? because it needs a response.
Btw I just tried to use remote function, but it doesn’t work either, none of them is firing, maybe because there is no response from client, but this is the problem, the client isn’t firing and I don’t know how to fix that.

1 Like

I wouldn’t use remote functions, especially not in this case. It’s unnecessary and would pose a security risk. I’d consider what I originally said and just only fire the server, since you were already able to do the things you fire client for in the original localscript that you fire the server from.

1 Like

So if I understand what you’re telling me to do is to only fire the server, but not everything can be done in a server script, I need those local script to make things with the camera or to access gui.
Tell me if I’m just stupid lol

1 Like

Well what I mean is that you already have a local script if you’re firing the server, so instead of firing the server then firing back to the localscript to do something locally, just change the order.

Your current order:

  1. Do something on local then fire the server
  2. Do something on server then fire the client
  3. Do something on local

New Order:

  1. Do everything thing you need to do locally first, then fire the server
  2. Do everything you need to do server sided

Tell me if that isn’t what you’re going for.

2 Likes

yo that’s a really good idea I didn’t understand that!
Epic! thanks for your help i’ll try that and I’m pretty sure that’s the solution!
Thank you so much

2 Likes

Glad I could help! Let me know if you still need anything after you try it!!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.