What is your way to make a throwable item?

– Small note. If this is in the incorrect sub-forum. Please tell me and direct me to the correct subforum.

Right now, As a new scripter, im trying to figure out how does one make item ‘launch’ upon creation. So i do some research and i think BodyBlaBla thing is one way you can make thing launch. So i did some experiment and -nvm- make thing launch using BodyThrust and AngularVelocity.

Tell me, is this way accurate to make a throwable item. If isn’t, what is your way? Share it to me, im trying to figure it out.

– Edit : Nvm the method i just used failed lol. Imma try another

5 Likes

I think this should be placed in #help-and-feedback:scripting-support and also you tried using Velocity?

2 Likes

Which velocity? Properties or bodyVelocity. If the body one, i hasn’t tried it yet.

2 Likes

Propieties. The body one isn’t working very well. If it doesn’t work how you want you may learn how to use Bazier curves (or something like that)

1 Like

Imagine as like throwing a grenade. Can you do something like that? I don’t think bezier curves could help me as it follow curve, not gravity and force.

2 Likes

You can use Velocity, and it’s x is the mouse’s position, the y is the mouse’s position + the magnitude between mouse’s position and the character and z is the mouse’s z

2 Likes

How do one get the mouse position? Do you use UserInputService or GetMouse? And how?

1 Like

Using the Mouse.Hit, you should learn the basics like Events before scripting advanced stuff.

1 Like

You’d probably have better success getting an answer if you post in Scripting Support.

1 Like

I said to move the topic but he doesn’t want.

1 Like

Haha, sorry for my naive-ness lol. I really feel Mindblank today. Of course i know event, but i didn’t bother searching it on object browser because of my laziness and mindblank. I should improve

Thanks for the reminder anyway

@TheTurtleMaster_2

Hmm. Using your formula

The script do work. However, the ‘item’ i want to throw just flung out to the side. Especially if i aim on the skyboxes.

local Snowball = game.ServerStorage:FindFirstChild("Snowball"):Clone() -- Snowball sprite
		Snowball.Parent = game.Workspace
		Snowball.Position = player.Head.Position
		wait(0.5) -- Make sure the snowball no longer clipping with the player head.
		Snowball.CanCollide = true
		Snowball.BrickColor = BrickColor.new(Color)
		Snowball.Velocity = Vector3.new(MousePosition.x,MousePosition.y + Magnitude,MousePosition.z)

Is this the formula you mean?

You can clamp the Magnitude or using math.min on the Magnitude, can we see where you are setting the magnitude?

Just a casual (Mouse.hit - Character).magnitude. What’s wrong?

What is character? The player’s character’head or something like that?

Yeah. But the snowball can be clipped upon creation. Setted to Collideable 0.5 second after creation just like you can see in the script.

You can always make Magnitude smaller using

Magnitude = math.min(Magnitude,20)

Just tried it. The ball go smoothly when targeted on ground or any other part. However, of course using the mouse position to set the velocity. The ball still fly really fast, thus creating the effect “Its too fast i didn’t see it happened” when pressed on skybox. And probably go fast too if press on a far object.

I might just try to find another method.

If you don’t need this method then you should learn about Bazier Curves.

Good grief…

I actually might try. Still have hope for the BodyThrust or body else tho.

I would suggest you using body velocity.
For example

local mouse = player:GetMouse()
local Speed = 50
tool.Activated:Connect(function()
  local bodyVelo = Instance.new("BodyVelocity", tool.Handle) -- Thing you want to throw
  bodyVelo.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  bodyVelo.Velocity =  CFrame.new(tool.Handle.Position, mouse.Hit.p).LookVector * Speed
end)
4 Likes