Issue on trying to replicate knife to client

I’m trying to replicate a knife to all players except the LocalPlayer

The issue is that the function works and all, I’ve tested it but it still not replicating to any clients at all in an actual server, there’s nothing cloning in the Debris folder I made and I have no idea how to go about fixing this issue

Client Script:

ReplicateThrow.OnClientEvent:Connect(function(player, pos, dir, speed)
				if isEventConnected then
					return
				end

				isEventConnected = true

				local KnifeModel = AssetsFolder:WaitForChild("Knife")

				local FakeKnife = KnifeModel:Clone()
				FakeKnife.Name = "FakeKnife"
				FakeKnife.Parent = workspace.Debris
				FakeKnife.Transparency = 0

				FakeKnife.CFrame = CFrame.new(pos, pos + dir)
				FakeKnife.Velocity = dir * speed

				local fakeHitbox = RaycastHitbox.new(FakeKnife)
				fakeHitbox.DetectionMode = RaycastHitbox.DetectionMode.PartMode
				fakeHitbox:HitStart()

				fakeHitbox.OnHit:Connect(function(hit, _, raycastResult)
					local normal = raycastResult.Normal
					local position = raycastResult.Position

					local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
					if humanoid and humanoid.Parent == Character then
						return
					end

					-- Ignore collisions with parts belonging to the player's character
					local isPlayerCharacter = false

					for _,part in pairs(Character:GetDescendants()) do
						if part == hit then
							isPlayerCharacter = true
							break
						end
					end

					if isPlayerCharacter then
						return
					end

					FakeKnife.Velocity = Vector3.new(0, 0, 0)
					FakeKnife.Anchored = true
					FakeKnife.Position = position

					debounce = false

					task.wait(2)

					FakeKnife:Destroy()
					return
				end)

				print(KnifeSpeed)
				print(direction)
				print(position)
			end)

			ReplicateThrow:FireServer(position, direction, KnifeSpeed)

Server Script:


function bounceRemote(player, pos, dir, speed)
	for i,v in ipairs(game.Players:GetPlayers()) do --getting all the players in the game
		
		
		if v ~= player then 
			warn("Player who sent: " .. tostring(player) .. "\n Player who Recieved:" .. tostring(v) .. "\n Other Variables:" .. tostring(pos), tostring(dir), tostring(speed)) --all players BUT the one who blew it, (they already ran it on the client in the earlier code at blowBubble(player) after BlowEvent:FireServer()
			ReplicateThrow:FireClient(v, player, pos, dir, speed)
		end
	end
end

ReplicateThrow.OnServerEvent:Connect(bounceRemote)

it’ll be much appreicated if someone helps me with this problem

Still waiting for you to show me the api. Show me the part where it says “FireAllClients() can’t specify it. It just takes extra arguments, you can’t exclude any players.”

Exactly it didn’t said it, but this is what it meant. Don’t be too lazy, just go and see. I don’t wanna argue man. Or why can’t you just make your script and show it.

Be peaceful to anyone on DevForum dude. I wasn’t even trying to argue. Don’t start these hll arguments.

Even though I love watching ppl argue you guys need to lift your hands from your keyboard and think for a sec if this is worth it lmao. Aint no way you all are experienced in this for 15 / 5-6 yrs (basically grown people) acting like this. This is roblox gn this is so unserious. You all better not try to work for serious groups cause they will check your profiles and find this weird argument

2 Likes

Do you guys mind? you’re both acting childish in this scenario.

What I should do now is delete all my posts, and move on. Moderation will see all the posts you made. As you said, you don’t care. So Ima flag it.

1 Like

Did u test it on just a server/client to see if there is an problem with knife movement. Your replication looks fine.

1 Like

You can write a function that loops through all players in the game and checks if player ~= exclude.

local function FireToOthers(exclude: Player, remote: RemoteEvent, ...)
    for _, player in Players:GetPlayers() do
        if player ~= exclude then
            remote:FireClient(player, ...)
         end
    end
end

--/ Example usage of `FireToOthers`, tailored to your post.
FireToOthers(KnifeOwner, ReplicateThrow, position, direction, KnifeSpeed)

I wrote this function on mobile, so please mind the formatting. It should work, and you can even make it a module if you wanted.