So I tried using a serverscript for the remotes so the localscript can go client to server and server to client.

I just hope someone can explain me how it actually works because I only understand a part of it.

My goal is getting the localscript to work and become filtering enabled If this is not allowed here then please tell me.

--LocalScript


local ContextActionService = game:GetService("ContextActionService")

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


local debounce = false

local function pressedXHandler()
 game.Push.ReplicatedStorage:FireServer()
	
    if debounce then return end 
    debounce = true 
    local hitCharacter = mouse.Target.Parent
    local hitHumanoid = hitCharacter:FindFirstChildWhichIsA("Humanoid")
    if hitHumanoid then
       
        hitHumanoid:TakeDamage(25)
hitCharacter.Humanoid.Sit = true
local Push = Instance.new("BodyVelocity", hitCharacter.Torso)
Push.Velocity = hitCharacter.Torso.CFrame.lookVector * -63
Push.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

local Distance = Instance.new("BodyPosition", hitCharacter.Torso)
Distance.MaxForce = Vector3.new(0, 0, 2)
Distance.Position = Vector3.new(0, hitCharacter.CFrame.p.Y + 15, 0)

Push:Destroy()
Distance:Destroy()


        wait(5)
        hitCharacter.Humanoid.Sit = false
end 
    wait(20) 
    debounce = false 
end

ContextActionService:BindAction("Push", pressedXHandler, false, Enum.KeyCode.X)

-ServerScript

game.ReplicatedStorage.Push.OnServerEvent:Connect(function()
 print("This was to check if it would appear in the output")
script.Parent.Push:FireServer()
script.Parent.Push.OnServerEvent:Connect(function()
	
	
end)

There is a remoteEvent in replicatedstorage

1 comment

0

you completely misunderstood how remotes works