My code doesn’t seem to be working I tried debugging and the server is not getting fired.
(Im making a push script)
local player = game:GetService("Players").LocalPlayer
repeat wait()
until player.Character
local char = player.Character
local mouse = player:GetMouse()
local tool = script.Parent
local remote = tool.RemoteEvent
tool.Activated:Connect(function()
if remote then
local target = mouse.Target
if target then
if target:FindFirstAncestorOfClass("Model") then
local model = target:FindFirstAncestorOfClass("Model")
if model:FindFirstChild("Humanoid") then
remote:FireServer(model)
end
end
end
end
end)
Server script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player,victim)
if (victim.HumanoidRootPart.Position-player.Character.HumanoidRootPart.Position)<=5 then
print("Fired")
local force = Instance.new("BodyVelocity")
force.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
force.Velocity = (-victim.CFrame.LookVector)*100
force.Parent = victim.HumanoidRootPart.Position
wait(0.2)
force:Destroy()
end
end)