I am raycasting downwards from the HumanoidRootPart to find a part and teleporting character to the position of the raycastResult.
When high up, the visualization says it is going down, yet it angles to the side.
robloxapp-20210607-1106278.wmv (4.9 MB)
local origin = char.HumanoidRootPart.CFrame.Position
local sfx = script:WaitForChild("SFX")
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(char:WaitForChild("HumanoidRootPart")["Anoobis"]["AnoobisTwo"])
local s1 = sfx["AnoobisTwoBonkSoundFX"]
local s2 = sfx["AnoobisTwoOofChargeup"]
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {char}
local raycastResult = workspace:Raycast(origin,origin+Vector3.new(0,-1000,0),raycastParams)
hiddenInstance:VisualizeRays(origin,origin+Vector3.new(0,-1000,0))
if raycastResult then
if raycastResult.Instance then
char.HumanoidRootPart.Anchored = true
-- [?] Effects\n
local offset = (char.HumanoidRootPart.CFrame.LookVector*5)
local raycastResult2 = workspace:Raycast(origin+offset,(origin+offset)+Vector3.new(0,-1000,0),raycastParams)
hiddenInstance:VisualizeRays(origin+offset,(origin+offset)+Vector3.new(0,-1000,0))
if raycastResult2 then
if raycastResult2.Instance then
anim:Play()
char.HumanoidRootPart.Anchored = false
local dest = game:GetService("ServerStorage"):WaitForChild("Effects")["AnoobisTwo"]
local direction = raycastResult2.Position
local es1,ed1 = Enum.EasingStyle.Circular,Enum.EasingDirection.Out
local es2,ed2 = Enum.EasingStyle.Circular,Enum.EasingDirection.In
for i,v in pairs(char:GetDescendants()) do
if (v:IsA('BasePart') or v:IsA('UnionOperation')) and v.Name ~= "HumanoidRootPart" then
local k = v:Clone()
k:ClearAllChildren()
k.Material = Enum.Material.Neon
k.Transparency = 0.25
k.Color = BrickColor.Yellow().Color
k.Anchored = true
k.CanCollide = false
print(k == v)
k.Parent = char.HumanoidRootPart["Anoobis"]
local a = tS:Create(k,TweenInfo.new(1,es1,ed1),{Size = v.Size*1.25,Transparency = 1})
a:Play()
game:GetService("Debris"):AddItem(k,1)
local k2 = v:Clone()
k2:ClearAllChildren()
k2.Material = Enum.Material.Neon
k2.Transparency = 0.25
k2.Anchored = true
k2.CanCollide = false
k2.Color = BrickColor.Blue().Color
k2.Parent = char.HumanoidRootPart["Anoobis"]
local b = tS:Create(k2,TweenInfo.new(1,es1,ed1),{Size = Vector3.new(0,0,0),Transparency = 1})
b:Play()
game:GetService("Debris"):AddItem(k2,1)
local c = tS:Create(v,TweenInfo.new(1,es1,ed1),{Transparency = 1})
c:Play()
end
end
script:WaitForChild("Client"):FireClient(player,"Teleport",raycastResult.Position+Vector3.new(0,5,0),char.HumanoidRootPart.CFrame.LookVector,char.HumanoidRootPart)
wait(.1)
for i,v in pairs(char:GetDescendants()) do
if (v:IsA('BasePart') or v:IsA('UnionOperation')) and v.Name ~= "HumanoidRootPart" then
local k = v:Clone()
k:ClearAllChildren()
k.Material = Enum.Material.Neon
k.Anchored = true
k.Size = v.Size*1.25
k.CanCollide = false
k.Transparency = 1
k.Color = BrickColor.Yellow().Color
k.Parent = char.HumanoidRootPart["Anoobis"]
local a = tS:Create(k,TweenInfo.new(1 ,es1,ed1),{Size = v.Size*0.75,Transparency = 0.25})
a:Play()
game:GetService("Debris"):AddItem(k,1 )
local k2 = v:Clone()
k2:ClearAllChildren()
k2.Material = Enum.Material.Neon
k2.Transparency = 0.25
k2.Anchored = true
k2.CanCollide = false
k2.Size = Vector3.new(0,0,0)
k2.Color = BrickColor.Blue().Color
k2.Parent = char.HumanoidRootPart["Anoobis"]
local b = tS:Create(k2,TweenInfo.new(1 ,es1,ed1),{Size = v.Size*1.25,Transparency = 1})
b:Play()
game:GetService("Debris"):AddItem(k2,1 )
local c = tS:Create(v,TweenInfo.new(1 ,es1,ed1),{Transparency = 0})
c:Play()
end
end
wait(.2)
local es,ed = Enum.EasingStyle.Sine,Enum.EasingDirection.Out
local destination = dest:Clone()
destination.Position = direction+Vector3.new(0,2,0)
local atPos = destination.Attachment
for i,v in pairs(destination:GetDescendants()) do
if v:IsA("BasePart") then
v.Position = atPos.WorldPosition
end
end
local pe = destination:WaitForChild("Attachment"):WaitForChild("ParticleEmitter")
coroutine.resume(coroutine.create(function()
local sf2 = s2:Clone()
sf2.Parent = char.HumanoidRootPart
sf2:Play()
--sf2:Destroy()
wait(.1)
local sf1 = s1:Clone()
sf1.Parent = destination
sf1:Play()
sf1:Destroy()
local sf3 = sfx["AnoobisTwoExplosion"]:Clone()
sf3.Parent = destination
sf3:Play()
--sf3:Destroy()
end))
pe.Enabled = true
-- [?]: Rough Shockwave Electricty\n
local sp1 = true
local rse = destination:WaitForChild("RoughShockwaveElectricity")
rse.Size = Vector3.new(40,1,40)
local SizeY = rse.Size.Y + 24
local rseTS: tween = tS:Create(rse,TweenInfo.new(0.3,es,ed),{Size = Vector3.new(rse.Size.X,SizeY,rse.Size.Z),Position = Vector3.new(rse.Position.X, rse.Position.Y - ((-1*(SizeY))/2) + (rse.Size.Y/2), rse.Position.Z),Transparency = 1})
coroutine.resume(coroutine.create(function()
while sp1 do
wait()
rse.CFrame = rse.CFrame*CFrame.Angles(0,-2,0)
end
end))
-- [?]: Shockwave mesh\n
local sp2 = true
local sm: instance = destination:WaitForChild("Shockwave mesh")
sm.Size = Vector3.new(3,3,3)
local smTS: tween = tS:Create(sm,TweenInfo.new(0.3,es,ed),{Size = Vector3.new(45,45,3),Transparency = 1})
coroutine.resume(coroutine.create(function()
while sp2 do
wait()
sm.CFrame = sm.CFrame*CFrame.Angles(0,3,0)
end
end))
-- [?]: StrongGravity\n
local sp3 = true
local sg: instance = destination:WaitForChild("StrongGravity")
sg.Size = Vector3.new(2,2,2)
local sgTS: tween = tS:Create(sg,TweenInfo.new(0.3,es,ed),{Size = Vector3.new(25,2,25),Transparency = 1})
coroutine.resume(coroutine.create(function()
while sp3 do
wait()
sg.CFrame = sg.CFrame*CFrame.Angles(0,3,0)
end
end))
-- [?]: SwirlShockwaveFire\n
local sp4 = true
local ssf: instance = destination:WaitForChild("SwirlShockwaveFire")
ssf.Size = Vector3.new(1,1,1)
local ssTS: tween = tS:Create(ssf,TweenInfo.new(1,es,ed),{Size = Vector3.new(75,75,75),Transparency = 1})
local rx3 = hiddenInstance:MakeRegion3(destination.Position - (Vector3.new(75,75,75)/2),destination.Position + (Vector3.new(75,75,75)/2))
local curated = hiddenInstance:CurateRegion3(rx3,{char})
print(curated)
for i,v in pairs(curated) do
if v.Parent and v.Parent:FindFirstChild("Humanoid") or game.Players:GetPlayerFromCharacter(v.Parent) then
print("Passed1")
if not v.Parent:FindFirstChildOfClass("Humanoid"):FindFirstChild("AnoobisTwoDamage") then
print("Passed2")
if hiddenInstance:DamageRequirementsMet(player,char,v.Parent,action,pos) then
print("Passed3")
local enemychar = v.Parent
local eHum = v.Parent:FindFirstChildOfClass("Humanoid")
local deb = Instance.new("ObjectValue")
deb.Value = player
deb.Name = "AnoobisTwoDamage"
deb.Parent = eHum
local _damage = hC.new()
local kB = Instance.new("BodyVelocity")
kB.Velocity = (enemychar.HumanoidRootPart.Position - destination.Position).Unit*75
kB.MaxForce = Vector3.new(9e999,9e999,9e999)
kB.Name = "Knockback"
kB.Parent = enemychar.HumanoidRootPart
_damage:init(eHum,10+(((enemychar.HumanoidRootPart.Position-destination.Position).Magnitude)*4),false,{"Subtract"})
print((((enemychar.HumanoidRootPart.Position+destination.Position).Magnitude)*10),(((enemychar.HumanoidRootPart.Position-destination.Position).Magnitude)*10))
_damage:Destroy()
game:GetService("Debris"):AddItem(deb,0.03)
game:GetService("Debris"):AddItem(kB,0.03)
end
end
end
end
coroutine.resume(coroutine.create(function()
while sp4 do
wait()
ssf.CFrame = ssf.CFrame*CFrame.Angles(5,-5,5)
end
end))
-- [?]: TornadoStrong\n
local sp5 = true
local tns: instance = destination:WaitForChild("TornadoStrong")
tns.Size = Vector3.new(35,1,35)
local SizeY = tns.Size.Y + 15
local tnsTS: tween = tS:Create(tns,TweenInfo.new(0.3,es,ed),{Size = Vector3.new(tns.Size.X,SizeY,tns.Size.Z),Position = Vector3.new(tns.Position.X, tns.Position.Y - ((-1*(SizeY))/2) + (tns.Size.Y/2), tns.Position.Z),Transparency = 1})
coroutine.resume(coroutine.create(function()
while sp5 do
wait()
tns.CFrame = tns.CFrame*CFrame.Angles(0,6,0)
end
end))
-- [?]: Miscellaneous
destination.Parent = char
local l, lTS = hiddenInstance:CastLight(atPos,Color3.new(1, 1, 0.647059),0.35,5,1,25,2,0,true,0)
lTS:Play()
game:GetService("Debris"):AddItem(l,0.3)
game:GetService("Debris"):AddItem(destination,1.25)
rseTS:Play() ;smTS:Play() ;sgTS:Play() ;ssTS:Play() ;tnsTS:Play() -- [?]: playing the tweens\n
wait(.75)
pe.Enabled = false
end
end
else
return "RemoveCD"
end
else
return "RemoveCD"
end