So I was making a projectile with the Fastcast module and I’ve ran into a problem. When I assign a variable as the projectile, it does not shoot how it is supposed to in the fire function down below on the code. It doesn’t work when I assign the projectile as a variable. Any help?
Code:
elseif (v == 3) then
if (charging == true) then
tornado = script.Items.tornado:Clone()
tornado.Parent = workspace.Assets.VFX
tornado.CFrame = humrp.CFrame * CFrame.new(0,18,0)
return
end
Debris:AddItem(tornado, 10)
local connect
connect = tornado.Touched:Connect(function(hit)
local model = hit:FindFirstAncestorOfClass('Model')
if model and not hit:IsDescendantOf(char) then
local victimHum = model:FindFirstChildOfClass('Humanoid')
local victimHumrp = model.HumanoidRootPart
if (victimHumrp:GetAttribute('TornadoHit') == true) then
return
end
local knockback = Instance.new('BodyVelocity')
knockback.Velocity = Vector3.new(math.random(-10,10), 30, math.random(-10,10))
knockback.P = math.huge
knockback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
knockback.Parent = victimHumrp
Debris:AddItem(knockback, 1.5)
victimHum:TakeDamage(30)
victimHumrp:SetAttribute('TornadoHit', true)
task.delay(5,function()
victimHumrp:SetAttribute('TornadoHit',nil)
end)
end
end)
fire(player, mousePos, RightArm.RightGripAttachment, tornado, 150)
--TweenService:Create(tornado, TweenInfo.new(3), {['CFrame'] = CFrame.new(tornado.Position + humrp.CFrame.LookVector * 200)}):Play()
task.wait(5)
connect:Disconnect()
for i, v in pairs(tornado:GetDescendants()) do
if (v:IsA('ParticleEmitter')) then
v.Enabled = false
end
end
end
It also doesn’t run code after the fire function which is the problem I have also assigned the tornado variable outside the OnServerEvent function.