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

How do i make this tool work with keys and not mouse? [closed]

Asked by
KOK_E 12
6 years ago
Edited 6 years ago

So i am not really a scripter and i have been struggling with this for past 2 weeks.

This tools work with filtering enabled but i need them to also work with the keys not just the mouse.

This is the code that needs to be changed.


local Player = game.Players.LocalPlayer script.Parent.Selected:connect(function(m) m.Button1Down:connect(function() Player.Character.Scripts.Chip.RKick:FireServer() end) end)

And this code leads to this.

script:WaitForChild("RKick")

local debris = game:service("Debris")
local Go = false
local Kick = false

script.RKick.OnServerEvent:Connect(function(Player)
    if Go == true then return end
    Go = true
    if Player.Character == nil then return end
    if Player.Character:findFirstChild("Torso") == nil then return end
    if Player.Character:findFirstChild("Right Leg") == nil then return end
    Torso = Player.Character.Torso
    RL = Player.Character["Right Leg"]
    Hip = Torso["Right Hip"]
    Hip.Part1 = nil
    W = Instance.new("Weld")
    W.Parent = RL
    W.Part0 = Torso
    W.Part1 = RL
    W.C0 = CFrame.new(0.5,-1.5,0.5) *  CFrame.fromEulerAnglesXYZ(-math.pi/4,0,0)
    wait(0.5)
    Kick = true
    W.C0 = CFrame.new(0.5,-1.5,-0.5) *  CFrame.fromEulerAnglesXYZ(math.pi/6,0,0)
    RL.Touched:connect(function(hit)
    if Kick == false then return end
    if hit.Locked == true or hit.Anchored == true then return end
    F = Instance.new("BodyVelocity")
    F.Parent = hit
    F.velocity = RL.CFrame.lookVector * 50
    F.maxForce = Vector3.new(4e+006,4e+004,4e+006)
    debris:AddItem(F,0.5)
    end)
    wait(0.5)
    Kick = false
    W:Remove()
    Hip.Part1 = RL
    Go = false
end)

How could i make this work on key like Z,E or any other keys?

Please help.

0
Not a request site. User#19524 175 — 6y

Closed as Not Constructive by User#19524

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?