#Needing help with tweening the orientation of a part !
512 messages · Page 1 of 1 (latest)
With it removed:
local RS = game:WaitForChild("ReplicatedStorage")
local Remote = script.Parent
local combatmod = require(game:GetService("ReplicatedStorage"):WaitForChild("Framework").CombatModule)
local TS = game:GetService("TweenService")
local TI1 = TweenInfo.new(.4, Enum.EasingStyle.Circular)
Remote.OnServerEvent:Connect(function(player, Skill)
local Character = player.Character
local HRP:Part = Character.HumanoidRootPart
local TS = game:GetService("TweenService")
if Skill == "Wind Slash 1" then
local Effect = RS.VFX["Wind Breathing Slash"].VFX:Clone()
Effect.Parent = workspace.Fx
Effect.CFrame = HRP.CFrame * CFrame.new(0,1,0) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(90))
game:GetService("Debris"):AddItem(Effect,2)
local Pos = Instance.new("BodyVelocity", HRP)
Pos.MaxForce = Vector3.new(999999999999,99999999999,99999999999)
Pos.P = 1
Pos.Velocity = HRP.CFrame.LookVector * 1
game.Debris:AddItem(Pos,.5)
local Sound = RS.Sounds.Downslam_Hit:Clone()
Sound.Parent = HRP
Sound:Play()
game.Debris:AddItem(Sound,2)
local Sound = RS.Sounds.Last:Clone()
Sound.Parent = HRP
Sound:Play()
game.Debris:AddItem(Sound,2)
local Sound = RS.Sounds["Flame_Charge_-_Mid_1_Sequence"]:Clone()
Sound.Parent = HRP
Sound:Play()
game.Debris:AddItem(Sound,2)
combatmod.CreateImpactFrame({Character}, .05, 2)
combatmod.CameraShake(HRP.CFrame,3000,.35,700)
task.wait(.1)
Effect.Outline1.Enabled = true
Effect.Outline2.Enabled = true
Effect.Slash1.Enabled = true
Effect.Slash2.Enabled = true
TS:Create(Effect, TI1, {Orientation = HRP.CFrame * Vector3.new(0,0,90)}):Play()
task.wait(.2)
Effect.Outline1.Enabled = false
Effect.Outline2.Enabled = false
Effect.Slash1.Enabled = false
Effect.Slash2.Enabled = false
end
end)
THE CODE ^
yo
-- replace this line
TS:Create(Effect, TI1, {Orientation = HRP.CFrame * Vector3.new(0,0,90)}):Play()
-- with this
TS:Create(Effect, TI1, {Orientation = (HRP.CFrame * CFrame.Angles(0, 0, math.rad(90))).toEulerAnglesXYZ()}):Play()
come back
the old
line
and change with this
local eulerX, eulerY, eulerZ = HRP.CFrame:ToEulerAnglesXYZ()
TS:Create(Effect, TI1, {Orientation = Vector3.new(eulerX, eulerY, eulerZ + math.rad(90))}):Play()
its gone back to doing this ^
insane
incase its not obv, what im tryna do is essentially this
I wonder if to
orientation
would fix it
local HRP_orientation = HRP.CFrame:ToOrientation()
TS:Create(Effect, TI1, {Orientation = HRP_orientation + Vector3.new(0,0,90)}):Play()
naw why CFrame have so many motheods
paste that over this?
methods*
yes
ðŸ˜
local HRP_orientation = HRP.CFrame:ToOrientation()
TS:Create(Effect, TI1, {Orientation = Vector3.new(HRP_orientation.X, HRP_orientation.Y, HRP_orientation.Z + 90)}):Play()
wait this will go back first error probably mhmm
or not
naw
lets try it simple
then
TS:Create(Effect, TI1, {Orientation = HRP.CFrame.LookVector}):Play()
went back to this issue ^
isnt that just 90 degrees off from where you're looking?
how does lookvector equal there?
oh. lookvector isn't orientation
im tryna get it to just spin downwards
@slim viper silly goose
you'll use a cframe of the player's humanoidrootpart, then offset it by a little bit in front of the player
so then the cframe will be a little in front of the player
truth but eh
basically
in front of the player's character yes?
then you just swing down
correct
shrimple right
your angle is right
your location isnt
you just set where the effect should be and you're golden
you mean like how it is up here?
yuh
in the video, its almost like anchored to this one side, as apposed to the persons front view
so you're doing math.rad twice?
thats been there the entire time and it hasnt worked
its 3am
we dont question these things
at 3am
remove the one that does it to the left
i go by whatever works, i dont remember 'axis' or whatever those kids say
alright
nah nah
smth like math.rad(90), 0, 0
but the 90 part should be in either the x or z
not both
still didnt work
smth like:
whatever * CFrame.Angles(math.rad(90), 0, 0)
OR
whatever * CFrame.Angles(0, 0, math.rad(90))
was talkin bout the math.rad part
0 is 0 either way afaik
yeah thats what i meant
and neither of which worked
where does it go now?
should set the position of it
the problem is the tweening
lemme rewatch
yeah but its before the tweenin
its at the very top
like one of the first things written
whereas the tweening is down the bottom
the tween is ruining it
that's just where you're starting vs ending
but it should still be at the front of the HRP no?
okay
so your end goal works, yes?
then what i was trying to do was add a tween that rotates it downwards
but the second the tween was added
it bugged
the top bit is yes, and its working correctly, but the orientation of the tween isnt
alr
seems like a play with values moment
so your actual problem is that the end orientation is wrong, i assume?
its smt thats missin
your origin is fine?
cause i know i had this issue before
but my friend fixed it and said it had to do with angles
but thats with the CFrame
yeah it's angles, angles do the orientation
but yes?
the tweening is tweening the part to rotate to 90 degrees to the left of the map, not the hrp
local x, y, z = HRP.CFrame:ToOrientation()
TS:Create(Effect, TI1, {Orientation = Vector3.new(x, u, z + math.rad(90))}):Play()
up - down
top left to bottom left is what i assume
a slash downwards
okay
this is what i meant, it seems to always end up on this side due to the tweening not locking onto the actual player but instead locking onto the games origin
oh my
it is rotating 90 degrees though
its not rotating the right way, no
i was gonna change that but i wanted to fix this first
lemme get a reference rq
what axis is that?
x y or z
that you're changing in the vid?
we NEED the tweening to understand its meant to be locked to the hrp but im not sure how to write that
.
x
im assuming x?
okay
this is 90 degrees x when facing away from player
it is doing exactly as you told it to, you're just doing the wrong axis
90 degrees z
you can think of it as the same position as the player
where origin is the first pic up here
so if you did 90 degrees z it would rotate downward 90 degrees as the part did
if you want it out and down, you'd just change the position forward a bit more
** You are now Level 15! **
but then isnt it still concerning that its not following the hrp
yep
of the tween
nw nw
was it?
yeah
then it's likely rotated by default
the part has 90
90 on the x = looks like the part i sent above
u get me?
it's following the hrp, but it's going off its own angle too
just do 0 on both
yeah yeah i feel you
angles are a bitch
it'l make it easier to tell
cause the orientation was already set at the top
same thing
neat
to the left?
try 90 y in addition
honestly, just play with it using 90/-90
if it goes behind you, put it negative
brother...
it'll work eventually
why does the task.wait have an error
then it does that
wait a minute
wait a minute
ðŸ˜*
Vector3.new(0, math.rad(90), 0)
your problem is it's just rotated 90 degrees to the left
so just keep rotating 90 degrees positive or negative until it works
exact same?
yep
radians = part of a circle where the radius is equal to the arc of the circle.
degrees = angle
oh?
figured
did it go above your head
nw
ikr ðŸ˜
you're doing 0, math.deg(90), 0?
ohhh, you're setting the orientation to 0, math.deg(90), 0 from the humanoidrootpart's orientation
if you do x, math.deg(90), z it'd probably do different
this'd be super cool as a knockback ability tho icl
basically changing from rotation of rootpart to directly 0, 90, 0 would cause this as it's going back to origin and 90 Y
likely gonna be x though
yeah im gonna keep it
so math.deg(90), 0, 0
is it forward or to the side?
lemme try this
dont do exactly 90 obv
this ^*
use math.deg always
so which bit do i change?
Orientation = Vector3.new(math.deg(90), 0, 0)
and if that isn't correct
Orientation = Vector3.new(0), 0, math.deg(90))
but likely the first
obv if it's backwards then just do -90
lemme try that
first thing just simply made it go back to that side again and spase out
second thing said unable to contact the dictionary or smt like that, so i removed the closed bracket at the end of the first 0 and it gave me this
bracket isnt the issue
what's the other error
X is probably wrong them if it spazzed out
try Z?
hm..
thats what the first thing did
the second line did this
yeah. that's on X
i'd just keep messing with the values and swapping axis between x and z
try on Z and not on X
it rotated left?
it gave me this error i had at the very beginning when i tried fixing it myself
sort of
yes
oops
i dont do much in the way of orientation tweening so im purely going off logic n such ðŸ˜
that pretty much did
so, works?
all around
nah
then 90 is too much, yes?
that's what ucan interpret
u can do 45?
its doing this ^^^^
it starts at the center
and goes down
to the bottom
its not doing that
hmm
watch this video right here
its doing exactly that
but
instead of around the floor of the player
its like a 360 sphere
from that im pretty sure
this does it at the position the player was at when they did it
which is correct
it's doing what it should
was this i think
yeah
not properly
you want it to go from above the player down?
or just less down?
not to mention
one slight angle change
and the whole thing breaks
meaning something is genuinely wrong within the code
it's just tweening
if anything, it could be the start position
i dont think it is
rewatch the video
you can see
it starts out straight
kicks out to the right
then lines back up
mid way through the impact frame, but you can see its straight
it's because of either hrp x or y
then kicks out
did 0, 0, math.deg(45), work?
then straightens back up
it's moving to the side because of the Y or X
you could do x, 0, math.deg(45)
nope
like i mntioned
one slight change in the angle
and it completely breaks
no
okay
it causes it to spase out
yeah
then do x, 0, math.deg(45)
it's the hrp x or y
one of them, you don't need
one of them, you do
i assume y
well i cant seem to revert back all the changes made
so i cant even get that straight slash back
it just spases out now
0, y, math.deg(90)
just spazzes out
same thing
idk what we did
but it wont go back to that
straight slash
x, y, math.deg(90) too?
yes
what
i dont understand either
it was fine
then i changed it to 45
like you said
and it spazzed out
now that i reverted it back
it wont go back to normal
that dont make no sense
i know
did u revert smth else on accident
send a copy of the game in team create so i can mess w it?
i checked that, and no
i can send you the script and vfx?
sure
how would i send off the script?
a model maybe?
try putting into a model
nope
it wont let me export
what has it got to do with the studio? 💀
im exporting just the script
thats it all opened up
are you right clicking "Folder" and export selection or doing smth else
if the former, i stand by my point: your roblox studio is being weird
i tried with the folder
i tried with the local script
both same error
even the model
yeah then it's weird