Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to use keydown with a remote event and destroy velocity instance?

Asked by 5 years ago
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.KeyDown:Connect(function(key)
    if key == "e" then
        script.keypress:FireServer()
    end
end)

here is my local script; keypress is a remoteevent

script.Parent.keypress.OnServerEvent:Connect(function(plr)
    local human = plr.Parent:FindFirstChild("Humanoid")
    local torso = human.Parent:FindFirstChild("Torso")
    local vello = torso:FindFirstChild("cutvelocity")
    if human and torso and vello then
        vello:Delete()
    end
end)

here is the script fired by remote event (cutvelocity is a rename of a bodyvelocity instance)

by pressing e i want the velocity to delete, but nothing happens

Answer this question