okay, so to start, lets make a function that will make the effect and start with a BasePart
function spellBolt(velocity, originCF)
local bolt = Instance.new("Part")
to achieve a
style effect you may want to use a ParticleEmitter
but lets just stay basic for this tutorial
bolt.Size = Vector3.new(1, 1, 1)
bolt.Material = Enum.Material.Neon
bolt.Transparency = 0.3
bolt.Anchored = false
bolt.CanCollide = false
we want this thing to move right? let’s add a BodyVelocity
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.Velocity = velocity
bv.Parent = bolt
finally, lets put the bolt into existance
bolt.CFrame = originCF
bolt.Parent = workspace
bolt.Touched:Connect(function()
--do damage and stuff
end)
end
so now when we want to make a new spell effect, just do this
--this is whatever function you have to catch the player remote event
--i'm not sure about the way you built your game, but i'm assuming you're
--having the server create the effects AND do hitboxes
--use remote events and don't forget security checks!
function activateWand(playerWhoRequested, direction)
--to get direction, you would just do a mouse raycast and send the vector
--to the server with the remote event
local character = playerWhoRequested.Character
local velocity = direction * 20
--i'm not sure where you want the player to cast the spell from, but for
--security, determine this place on the server, don't let the player send it
--through remote events
local originCF = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3)
spellBolt(velocity, originCF)
end
this was a very rough example that may not fit within the systems of your game, if you have any questions just ask!