Hitbox supposedly doesn't exist when sent to the client?

hi, I have a problem in my code where I fire all clients for a client-sided effect like so:

VFX:FireAllClients("MeraEffects", Character, Hitbox)

where the hitbox is a part that the effect will cframe itself to.

however, in the module that handles this (client), nothing occurs when the module is called, indicating that the hitbox doesn’t exist according to the client, whilst it does on the server.

client vfx code:

function MeraEffects.Effect(Character: Model, HikenHitbox: BasePart)
	local HumRP = Character:FindFirstChild("HumanoidRootPart")

	if HikenHitbox then
		local Hiken = script.Hiken:Clone()
		Hiken.Parent = workspace.Visuals
		Hiken.CFrame = HikenHitbox.CFrame
		
		repeat task.wait()
			Hiken.CFrame = HikenHitbox.CFrame
		until HikenHitbox.Parent == nil
		
		for _, effect in Hiken:GetDescendants() do
			if effect:IsA("ParticleEmitter") or effect:IsA("Trail") then
				effect.Enabled = false
			end
		end
		Debris:AddItem(Hiken, 3)
		
	end
end

upon printing the hitbox and its data on the client, it just returns nil.

Are you sure the function is actually running? Try printing something outside of the if statement and see if it actually runs.

Yeah, the module is being called correctly
image

Hmmm, could I see a bit more of the code that runs the VFX:FireAllClients()? The only problem I could really imagine to be causing this is that the hitbox part either never existed in the first place or it’s placed in a location that isn’t replicated e.g. ServerStorage (sorry for the late reply by the way)

What is the hitbox parented to?

a folder in the workspace which holds effects, hitboxes etc.
Funnily enough i’ve done this with no issues on one of my previous games

Try looking at the Explorer tab while testing, see if the client can see those hitboxes.
Is workspace.StreamingEnabled set to true?

image
hitbox exists, and I can see it in-game. StreamingEnabled is also on.

can i see more code of this script

not really much else to this script apart from creating the hitbox

	local Hitbox = ReplicatedStorage.Hitbox:Clone()
	Hitbox.CFrame = HumRP.CFrame
	Hitbox.Anchored = true
	Hitbox.Size = Vector3.new(2,2,2)
	Hitbox.Parent = workspace.Visuals
	
	VFX:FireAllClients("MeraEffects", Character, Hitbox)

Try adding a task.wait() before the remote event fire

nope, still doesn’t work.‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌

Try adding a longer wait like 1 second for testing purposes, might be that the client takes longer to load the hitbox,
also you haven’t answered my question in one of my previous message, is workspace.StreamingEnabled enabled?

alright, it works now, but the delay would be pretty inconvenient even if i changed it since the game is pretty fast paced. StreamingEnabled is on by the way

Try turning streaming off and remove the wait and test and add task.wait() and test see if it works, if it does you might have to put the hitbox into a model and set Model.ModelStreamingMode to Persistent

It works fine with streaming off, but wouldn’t having it off be a massive performance issue?

Turn streaming on put the hitbox into a model and set Model.ModelStreamingMode to Persistent. Also don’t forget to change your code so its doing Model.Part.Anchored instead of Model.Anchored :grin:

1 Like

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