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

making a keybind telekinesis, and it's not working, how do I fix it? [closed]

Asked by 5 years ago
Edited by User#24403 5 years ago

Making a script where when you click the Key bind, it holds the player in the air, and when you click again it throws them to the direction that you want. I've done it for a just mouse button but I'm trying to make it Key bind and it's not working.

Local Script

wait()



local Player = game:GetService("Players").LocalPlayer 

local char = Player.Character

local Mouse = Player:GetMouse()

local cooldown = 0

local replicatedstorage = game:GetService("ReplicatedStorage")







script.Parent.Equipped:Connect(function(mouse,key)

    mouse.KeyDown:Connect(function()

        local key = key:lower()

        if key == "h" then

        local hum =         mouse.Target.Parent:FindFirstChild("Humanoid")

        if hum then


            script.Parent.NewGrab:FireServer(hum,Mouse.hit,Player.name)
            game.Players.LocalPlayer.Character.Humanoid.JumpPower = 51




mouse.Button1Down:Connect(function()

    if game.Players.LocalPlayer.Character.Humanoid.JumpPower == 51 then

        local Hit = mouse.hit

        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50

        script.Parent.NewThrow:FireServer(Hit)

        script.Parent.Sound:Play()

        wait(2)

        game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50

                end

            end)

        end

      end

    end)

end)

Server Script

script.Parent.NewGrab.OnServerEvent:Connect(function(player,hum)
    if hum then
        local BP = Instance.new("BodyPosition")
        BP.MaxForce = Vector3.new(9999999,9999999,9999999)
        BP.Parent = hum.Parent.UpperTorso
        BP.Position = player.Character.UpperTorso.Position + Vector3.new(0,6,-3)

        script.Parent.NewThrow.OnServerEvent:Connect(function(player,Hit)
            BP.Position = player.Character.Head.Position + (Hit.p - player.Character.Head.Position).unit * 65
            wait(0.5)
            BP:Destroy()
        end)
        wait(3)
        BP:Destroy()
    end
end)
0
You need to give more context. Simply saying "it does not work" is not descriptive enough. User#24403 69 — 5y

Closed as Too Broad by User#24403

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?