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

How would you make this push people if the mouse is on them?[UNANSWERED]

Asked by 10 years ago

So, this is a script that allows the animation to play when a player presses a certain key. But I'm wondering how to make it do force push? Like how would you make it so if your mouse is on the player, then the player "Sits" and, then gets flung just alittle bit?

User = game.Players.TheReapersComing

UserMouse = User:GetMouse()



Animation = Instance.new("Animation")

Animation.AnimationId = "http://www.roblox.com/Asset?ID=165757504"  -- Animation's id to make it look like the player's pushing the other player.

Animation.Name = "Force push."

animTrack = User.Character.Humanoid:LoadAnimation(Animation)



UserMouse.KeyDown:connect(function(key) -- keydown function

    if key == "f" then

    animTrack:Play()

    end

end)
0
NOTE: Like how would you make it push, AND do the animation? TheReapersComing 0 — 10y

1 answer

Log in to vote
0
Answered by
nilVector 812 Moderation Voter
10 years ago

This is inside a LocalScript in Workspace.

wait()

local User = game.Players.LocalPlayer
local UserMouse = User:GetMouse()
Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/Asset?ID=165757504"
Animation.Name = "Force push."
local animTrack = User.Character.Humanoid:LoadAnimation(Animation)


while wait() do
    if UserMouse .Target then
        if UserMouse .Target.Parent:FindFirstChild("Humanoid") or   UserMouse.Target.Parent.Parent:FindFirstChild("Humanoid") then
            UserMouse.KeyDown:connect(function(key) -- keydown function
                   if key == "f" then
                        animTrack:Play()
                  end
            end)
        else
            animTrack:Stop()
        end
    end
end

Hope this helped!

0
It didn't work I did everything you said... TheReapersComing 0 — 10y
0
Are you trying to make yourself be pushed or the person you're hovering over be pushed? nilVector 812 — 10y
Ad

Answer this question