RemoteEvent not mysteriously working?

Adding the if statement will print nothing meaning the blood folder is nil but it shouldn’t be.

It prints on the server script the name of the folder.

if there isn’t a blood_folder then it’ll create one (assuming the blood_folder is a folder)

There’s a problem with this. It needs to be a singular script and if i delete the current folder the blood would disappear since the blood is spawned in the folder - Folder is in the character.

1 Like

You can try moving the blood to the new folder. Unless the indexing as nil stops that too?
Never knew a few lines of script could be this complicated lol
Client sided blood, wait…

Considering that you won’t show your code, we can only guess. But from what I can ascertain, the reason why you are getting that error is because on line 18 of blood_shake_fx is referencing a nil value. So what we really need to see is a few lines before and after, or just the function that contains line 18.

As mentioned before, you do not have player as a parameter on the client side of the remote event. That’s a server only parameter because that tells the server which client to sent the event to. I would like to see what this blood_folder parameter from the server is though and if that has something to do with your problem.

Beyond that, there’s not enough information to solve your problem. Even a screenshot from explorer on the client while the game is running showing the PlayerScripts directory would help.

2 Likes

Um…I see the problem. I don’t think you can send an instance through a remote event. It has to be a value like a number, string, boolean, or table. So if you are trying to reference the instance on the client, you will get nil.

The best way to solve this is that the code creates the folder on the server, then give it a little bit to replicate to the client, then from the server signal the client that the folder is there. The other thing is that you can make it part of the startup so that’s it’s always there when the client logs in.

alright

#30charrrrrrrrrrrrrrrrrrrrs

That’s odd. You should still be able to fire an instance because an instance is still a table, or rather a metatable.

Something else. I just tested it. You can place a folder called BloodFolder in StarterPlayer > StarterCharacterScripts and it will be there for each player character when they login.

In my experience, it doesn’t work. Although you can access an instance like a table, it’s not a table. It’s an actual instantiated class which is an object. An object like that has it’s own methods and references that it inherits. When you try to send an instance through a remote event, the function references will be different on the client, so it won’t work. That’s why it won’t allow you to do that.

Sorry if i am replying even if i marked you as the solution and my post might get flagged.

But does this code seem right to wait for it to replicate?
It seems to work perfectly fine.
Capture

I’m not sure, but I’m pretty sure that it works with parts and models.

Edit: I just tested it. It works with every Instance. I think it’s because on the client-side the instance doesn’t exist yet.

You could do that, but you could also do this on the client:

local replicatedStorage = game:GetService("ReplicatedStorage")
local playerService = game:GetService("Players")

replicatedStorage.blood_Events.bloodShakeFX.OnClientEvent:Connect(function()
	local localPlayer = playerService.LocalPlayer
	local char = localPlayer.Character
	local bloodFolder = char:WaitForChild("BloodFolder", 10)
	-- Do whatever
end)

That way, the client will wait up to 10 seconds for replication to take place before proceeding. You have to consider network latency when communicating between client and server. That’s why the wait is needed.

Remember, you don’t need to name the folder uniquely as the folder instance itself is unique to each character. Just calling it BloodFolder will be enough and it will simplify your code because you only have one name to use.