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)