How Would I Make A Good Looking Projectile?

Clip 1 What I want to achieve. (Slowed Down)

Clip 2 What I have done so far.

I want to get my projectile to look similar to the one in Magic Training by Serphos but I have no idea how.

Here is the the part of the script that controls what the projectile looks like and it’s properties (And the raycast)

local ray = Ray.new(Wand.Handle.End.CFrame.p, (mouse.Hit.p - Wand.Handle.End.CFrame.p).unit * 300)
		local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
		
 		local cole = player.Temp.cole.Value
		local beam = Instance.new("Part", workspace)
		beam.BrickColor = BrickColor.new(cole)
		beam.FormFactor = "Custom"
		beam.Material = "Neon"
		beam.Transparency = 0.25
		beam.Anchored = true
		beam.Locked = true
		beam.CanCollide = false
 	
		local distance = (Wand.Handle.End.CFrame.p - position).magnitude
		beam.Size = Vector3.new(0.3, 0.3, distance)
		beam.CFrame = CFrame.new(Wand.Handle.End.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

		game:GetService("Debris"):AddItem(beam, 0.1)

UPDATE:
I’ve been able to work out some sort of projectile. Currently the damage is done by the Raycast until I can fix what is happening with the projectile.

0

Here is the server script, so everything to do with the projectile

Fire.OnServerEvent:Connect(function(player, Wand, position)
	
	local proj = game.ReplicatedStorage.Objects.Bullet
	
	local BulletClone = proj:Clone()
	BulletClone.CFrame = Wand.Handle.End.CFrame
	BulletClone.Parent = workspace
	BulletClone.CanCollide = false
	BulletClone.Material = "Neon"
	BulletClone.Locked = true
	BulletClone.Transparency = 0.25
	
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	BodyVelocity.Velocity = position
	BodyVelocity.Parent = BulletClone
	
	spawn(function()
		for i = 0, 10 do
			BulletClone.Size = BulletClone.Size
			BodyVelocity.Velocity = position*i
		end
	end)
	game:GetService("Debris"):AddItem(BulletClone, 5)
end)

How do I get it so that it ends up more like Clip 1.

2 Likes

In clip 1, he’s using projectiles of some sort. Either using CFrames and a projectile physics formula or velocity. You’re just using raycasting which creates a “laser” kind of effect.

1 Like

If I’m not mistaken, visual effects should always be handled by the client if possible. Server sided checking like raycasts/etc are done on the server of course.

You should of course, as you’re probably doing, raycast on the server to the mouse’s hit position/ending pos from the wand. Of course, before you do a ray check, summon the part with a delay on the server while the effect happens on the client, you can fake the projectile movement of course if needed.

Then raycast at the appropriate moment when it detects a hit, if it detects correctly, it stops, if its not, it continues moving as usual.

Remote events will probably be required for this. Trails for effects, and etc.

2 Likes

Currently I am using a local script inside of a tool. How would I transfer the right parts of the script to the Server to handle?
(Done this)

Have a remote event call the server from the client of course (make sure it can be abused though). And activate any effects/tweens on the client when needed for the effects, at the same time, raycast on the server to where they clicked with a delay added on or something similar to verify.

I’ve done the remote event to activate it on the server but I’m still stuck with the actual effects and how to tween it.

Use BodyVelocity to make it move instead of TweenService. You should create a part that spawns on the wand and add a bodyvelocity to it instead of resizing it.

BodyVelocity is not what he uses. I specialize in sort of the creation of “Harry Potter wands” and what he is doing is a fairly common method, used in the genre but with a twist. Firstly the projectile is looped to new randomly generated Cframes in the direction of the ray casted in each loop. This is all in the direction of the end position(The mouse usually). You will need to firstly create your part(projectile), set it’s cframe to the start position, then create a loop. The loop can be a repeat, for or while loop. Then in this loop, create a ray using the start position as origin and the look vector of the cframe of the Start position facing the end position times the speed you want the spell to travel divided by 30. Then you need to make a new cframe to send that part to. You can do this my multiplying cframes or simply making a function to generate a new one. This gives the zig zag effect when put into action. Next make your hit detection by defining the hit, hit position, and normal by using findPartonray. I prefer with ignorelist but you do not have to. Next place the peojectile’s cframe to the generated one, and then set the origin to the hit position. Lastly check for your hit.
If you have a for loop or a while loop, be sure to break it if hit, that isnt necessary with a repeat as it will have set boundaries to break it if passed.

4 Likes

Have it throw a small sphere with a trail

@jamescreator10

s - Roblox
This game has a super basic demo
and here is a couple gif’s of one looped method. This one is with a while loop.
https://gyazo.com/b62ad1228033e260a81d28e93eb2f91d
https://gyazo.com/b62ad1228033e260a81d28e93eb2f91d

1 Like

Wait a second, so how does one even make that “spell” projectile shoot towards the place where the mouse is pointing?

What exactly do you use to have the special effects and also for having the spell projectile shoot instead of looking like a ray was immediately shot there. I want some sort of slow moving spell projectile shooting, like what you have in your demonstration.

How’d you do it?

You need to move it to random positions in the directions of the end position aka using a loop.

I don’t want the speed of the particle to be random, I want it to be able to shoot towards the position at a steady pace.

My answer is the same, the zigzag is just an added vector