FireAllClients() Not Working

hi
so i made a snow ball that players can throw it
and i use fireallclients to create the snowball on clients , but it only work at the player who fired the server
how do i do

here is code
Server

script.Parent.PC.OnServerEvent:Connect(function(player,mouse)
	local BallCFrame = CFrame.new(script.Parent.Handle.Position + script.Parent.Handle.CFrame.LookVector * 1,mouse)
	script.Parent.PC:FireAllClients(BallCFrame)
end)

Local

local player =game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.UserInputType == Enum.UserInputType.MouseButton1 and player.Character:FindFirstChild("PaperBall") then
		script.Parent.PC:FireServer(mouse.Hit.Position)
	end
end)

script.Parent.PC.OnClientEvent:Connect(function(cf)
	print("rc")
	local ball = game.ReplicatedStorage.ThrowBall:Clone()
	ball.Parent = workspace
	ball.CFrame = cf

	local attachment0 = Instance.new("Attachment",ball); attachment0.Position = Vector3.new(-.1,0,0); attachment0.Orientation = Vector3.new(0,180,0)
	local attachment1 = Instance.new("Attachment",ball); attachment1.Position = Vector3.new(.1,0,0)
	local trail = Instance.new("Trail",ball); trail.Attachment0 = attachment0; trail.Attachment1 = attachment1

	ball.AssemblyLinearVelocity = ball.CFrame.LookVector*125 + Vector3.new(0,25,0)

	ball.Touched:Connect(function()
		ball.CanTouch = false
		ball.CanCollide = true
	end)
end)

when i test 2 players , only the player1 who throw the ball can see the ball he threw , but other players cant see the ball that player1 threw

You need to move the RemoteEvent to ReplicatedStorage, if you leave it in the tool each tool will have their own RemoteEvent, so in this case, even though you’re using FireAllClients, only the RemoteEvent in the tool is fired and only the player who owns the tool is listening to it.

Edit: reading through your code again, I can’t really assume that the RemoteEvent is inside of a tool but either way, as long as the same RemoteEvent isn’t shared to all players, FireAllClients won’t behave properly.

1 Like

yes. the event is inside the tool
and i put the event to replicatedstorage, and it work now

1 Like

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