I already posted the same post before ut no ne seems to be replying so basically im creating a push script and when i debugged the server is firing successfully but the character is not being pushed
local script:
local player = game:GetService("Players").LocalPlayer
repeat wait()
until player.Character
local char = player.Character
local human = char:FindFirstChild("Humanoid")
local replic = game:GetService("ReplicatedStorage")
local remote = replic:WaitForChild("RemoteEvent")
local UIS = game:GetService("UserInputService")
local inputted = false
local fired = false -- keep track of whether RemoteEvent has already been fired for current touch event
UIS.InputBegan:Connect(function(input)
inputted = true
if inputted then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
for _,body_part in pairs(char:GetChildren()) do
if body_part:IsA("BasePart") then
body_part.Touched:connect(function(hit_part)
if not fired and hit_part.Parent:FindFirstChild("Humanoid") then
local hrp = hit_part.Parent.HumanoidRootPart
if hrp then
local direction = (hrp.Position-body_part.Position).Unit
remote:FireServer(direction,hrp)
fired = true
wait(0.1)
end
end
end)
end
end
end
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
inputted = false
if not inputted then
fired = false
return
end
end
end)
server script:
local replic = game:GetService("ReplicatedStorage")
local remote = replic:FindFirstChild("RemoteEvent")
remote.OnServerEvent:Connect(function(player,direction,hrp)
print("Server fired")
local force = Instance.new("BodyForce")
force.Force = direction * 1000
force.Parent = hrp
wait(0.1)
force:Destroy()
end)