I have a local script that adds a BodyForce to whatever I click on. So far it's worked with all different parts, including NPCs with HRPs. However, when I publish it and hop on the server, it doesn't work on other players. It works fine on basic parts, and the NPC, but when I click on a real player on the server, they disappear for like half a second then reappears without any force applied; it flickers. Anyone got any ideas?
`local camera = workspace.CurrentCamera local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
local screenRay = camera:ScreenPointToRay(mouse.X, mouse.Y) local length = 500 local ray = Ray.new(screenRay.Origin, screenRay.Direction * length) local hit,position = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.Baseplate}) if hit then local hitCFrame = hit.CFrame local playerCFrame = player.Character.HumanoidRootPart.CFrame --local distance = playerCFrame:DistanceFromCharacter(hitCFrame.Position) --print(distance) print(hit.Name) local force = Instance.new("BodyForce") --local gyro = Instance.new("BodyGyro") local magnitude = 1000 if hit.Parent:FindFirstChild("Humanoid") then print("Person!") force.Parent = hit.Parent.HumanoidRootPart --gyro.Parent = hit.Parent.HumanoidRootPart hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown) hitCFrame = hit.Parent.HumanoidRootPart.CFrame -- Check if player has an int value -- if they dont, add it -- add to the int value -- use int value as multiplier else force.Parent = hit --gyro.Parent = hit end hitCFrame = CFrame.new(hitCFrame.Position, playerCFrame.Position) force.Parent:SetNetworkOwner(player) force.Force = hitCFrame:vectorToWorldSpace(Vector3.new(0,4,3) * magnitude) wait(0.25) force:Destroy() --gyro:Destroy() end
end)`