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

Making BodyVelocity more accurate?

So I'm making this attack where three rocks are fired at where the mouse is pointing when you click. Everything fires well but the rocks seem to miss its target drastically.

This is what it looks like: Rock Shooting

These are the lines of code that I'm using to make the rocks fire, theres more before it but I think this is where the problem is:

enabled2 = true
speed = 50
Carbons = {CarbonH, CarbonH2, CarbonH3,}
welds = {weld1, weld2, weld3,}
local clearing = 1
Mouse.Button1Down:connect(function(key)
	if not enabled2 then
        return
	   end
	enabled2 = false

welds[clearing]:Destroy()

local Woosh = Instance.new("BodyVelocity")
	  Woosh.maxForce = Vector3.new(math.huge, math.huge, math.huge)
	  Woosh.velocity = CFrame.new(Player.Character.Torso.CFrame.p, Mouse.Hit.p).lookVector * speed
	  Woosh.Parent = Carbons[clearing]
	  Carbons[clearing].Parent = workspace

clearing = clearing + 1

wait(1)
enabled2 = true

if clearing == 4 then
	enabled2 = false
	wait(5)
	enabled = true
end
	end)
		end
			end)

I think lines 14-18 is where the problem is but I can't figure out whats wrong.

If you need the whole script please tell me and thank you.

1 answer

✓ Accepted answer

Alright, so your problem might be in lines 14-18 and I think I know what it is sorry it's hard to tell because I can't just copy and paste your script into my studio and test it because apparently you got some other part in the script that isn't here because it keeps erroring the ends and the tables... so anyways..... For the BodyVelocity.... You should do something like this

Woosh.velocity = CFrame.new(Player.Character.Torso.Position, Mouse.hit.p)

I hope this helped!

4 comments

0

Sorry it didnt make much of a difference, I could put the whole script if that would help you help me?

0

Nevermind I fixed it by editing your line a little, thank you so much

0

No problem btw I think I met you before on Scripting Hangout on Reverge's Scripting Hangout game xD

0

All you had to do was .lookVector * speed

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