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)
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!