Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

1 comment

0

NOTE: Like how would you make it push, AND do the animation?

1 answer

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!

2 comments

0

It didn't work I did everything you said...

0

Are you trying to make yourself be pushed or the person you're hovering over be pushed?

This discussion is preserved as it was. New answers, comments, and votes are closed.