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

Body Velocity problems, how do I do this?

I wanted to make a script where you can pull something your way with the force ( Star wars) So what I want to happen is the item you click (If its unanchored) needs to have a force towards your right hand. I tried it but the mouse.Target shoots towards a way different direction. I've tried messing with the maxforce and such but It never went near the arm. Please help out! How do I do this?

This is the script

-- Configurable variables
PushPull = true -- Push is True, Pull is False
JediLevel = 10

-- Non-Configurable variables
CooldownPush = 0
CooldownPull = 0
Stamina = 100
mouse = nil
Hit = nil
Target = nil
Tool = script.Parent
oldC0 = nil
nweld = nil
v = nil

script.Parent.Activated:connect(function()
	mouse = game.Players.LocalPlayer:GetMouse()
	Hit = mouse.hit
	Target = mouse.Target
	if mouse.Target ~= nil then
	if mouse.Target.Parent ~= nil then
	if PushPull == true then
		if CooldownPush == 0 then
			if Stamina >= 59 then
				if Target.Anchored == false then
					v = Instance.new("BodyVelocity", Target)
					v.Velocity = game.Players.LocalPlayer.Character["Right Arm"].Position * 180
					v.MaxForce = Vector3.new(100,100,100)
				end
	end	
	end
	end
	end
	end
end)

1 answer

Maybe you should try to create something where you define the position of the player, and the object that you want flown.

For instance, I suggest making a script that defines the position of the players

The next one defines the position, of, let's say the unanchored object is a Rock.

What would happen I think is similar to what would happen if you created a platform that went 1 way, similar to some tutorial lessons for obbys.

Except, this platform, or the rock, is going 1 way, to the player, so maybe that could be changed using the body position thing!

I'm not an expert at this, but maybe this is some help!

Edit: So, basically what I am telling you, is that this is similar to those tutorial lessons on roblox wiki on how to make an obby. I dont know if the lessons are there there, but if you do know how to make a platform that goes left and right, surely you can use that method to go one dirrection.

Also, to define the position of the player, try making some scripts that define his position, I dont know the function bt im sure this one is easy.

You could also ask a question on this!

1 comment

0

Thanks for replying but I have no clue what you're trying to say. It's probably me being from Europe but could you give a script example or tell me in noobglish?

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