Client returning nil

My goal is to try to fire the client to make the bomb explode when it touches something, for some odd reason the bomb is nil on the client

I have tried looking through the dev forum for some help, but i couldnt find anything.

Server

		local char = plr.Character
		local hrp = char.HumanoidRootPart
		local bomb = game.ReplicatedStorage.Bomb:Clone()
		local force = Instance.new("BodyVelocity")
		force.MaxForce = Vector3.new(99999,99999,99999)
		force.Velocity = mousepos.LookVector * 50 + Vector3.new(0,25,0)
		force.Parent = bomb
		bomb.Parent = game.Workspace
		bomb.CFrame = hrp.CFrame * CFrame.new(0,0,-1)
		game.ReplicatedStorage.PlayerEvents.BombClient:FireClient(plr,bomb)

client

client.OnClientEvent:Connect(function(bomb)
	print(bomb)
	if bomb ~= nil then
		bomb.Touched:Connect(function(hit)
			if hit.Parent ~= char and not hit.Parent:IsA("Accessory") then
				server:FireServer(bomb)
			end
		end)
	end
end)
3 Likes

Not too experienced with forces, but that looks pretty heavy. Are you sure bomb isn’t somehow being destroyed by falling into the void or something similar?

it isnt being destroyed from falling into the void

You are probably firing it right after the server starts, try waiting a bit (like 5-10 seconds)
I tested it and after waiting for a while it works normally again, the game was probably not loaded for the client when it was fired

then it’s a easy fix:

if not game:IsLoaded()then game.Loaded:Wait()end

This doesn’t work on a server script, it makes the code yield
game.Loaded is only intended for clients, and if you do that there, it will error “Remote event invocation queue exhausted” while the game hasn’t loaded yet

then just do .Loaded and request the server that the client loaded.
(the server waits the client to load)

Yeah i just treid this and replicated same issue, if i add a task.wait(1) before sending the fireclient then it works but thats obviously not a good way to do it,

so what im thinking is that if you could send to the client the bomb cframe and velocity and let the client create the bomb themself (since its only firing to 1 client then that shouldnt be an issue) that could work and give the same effect