#Needing help with tweening the orientation of a part !

512 messages · Page 1 of 1 (latest)

craggy hazel
#

With the CFrame value written: ^

#

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 ^

slim viper
#

@craggy hazel

#

hi

craggy hazel
#

yo

slim viper
#
-- 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()
craggy hazel
#

1 sec

slim viper
#

a

#

bad use of it

#

wait

#

skill issue

craggy hazel
#

😭

#

scripting is challenging

slim viper
#

well that line

#

is the issue

#

thats what u need

#

to know

slim viper
#

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()
craggy hazel
#

im here

#

wsp

craggy hazel
slim viper
#

insane

craggy hazel
#

incase its not obv, what im tryna do is essentially this

slim viper
#

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

slim viper
#

methods*

slim viper
craggy hazel
#

im doomed

slim viper
#

again my skill issue

#

I hate this type

#

of errors

craggy hazel
#

😭

slim viper
#
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

craggy hazel
#

lemme try

slim viper
#

lets try it simple

#

then

#
TS:Create(Effect, TI1, {Orientation  = HRP.CFrame.LookVector}):Play()
craggy hazel
slim viper
#

lol

#

gg

brave jolt
brave jolt
#

oh. lookvector isn't orientation

craggy hazel
brave jolt
#

@slim viper silly goose

brave jolt
slim viper
#

vector3

#

shit

brave jolt
#

orientation is math.deg

#

or whatever

#

rad or smth

slim viper
#

truth but eh

brave jolt
#

u get the point

#

it's an angle

craggy hazel
#

i am

#

so lost

#

💀

brave jolt
#

in front of the player's character yes?

#

then you just swing down

craggy hazel
#

correct

brave jolt
#

shrimple right

#

your angle is right

#

your location isnt

#

you just set where the effect should be and you're golden

craggy hazel
#

you mean like how it is up here?

brave jolt
craggy hazel
brave jolt
#

so you're doing math.rad twice?

craggy hazel
brave jolt
#

why is it 90,0,90?

#

isn't one of them to the left?

#

which would cause your problem?

craggy hazel
#

we dont question these things

#

at 3am

brave jolt
#

remove the one that does it to the left

#

i go by whatever works, i dont remember 'axis' or whatever those kids say

craggy hazel
#

so the final one?

#

on the far right

brave jolt
#

remove one of 'em until it works

#

should only have one

craggy hazel
#

alright

craggy hazel
#

?

brave jolt
#

nah nah

#

smth like math.rad(90), 0, 0

#

but the 90 part should be in either the x or z

#

not both

craggy hazel
#

still didnt work

brave jolt
#

smth like:

whatever * CFrame.Angles(math.rad(90), 0, 0)

OR

whatever * CFrame.Angles(0, 0, math.rad(90))
craggy hazel
brave jolt
craggy hazel
#

and neither of which worked

brave jolt
#

where does it go now?

craggy hazel
#

this top part we are editng

#

doesnt change it

#

thats not the problem

brave jolt
#

should set the position of it

craggy hazel
#

the problem is the tweening

brave jolt
#

lemme rewatch

craggy hazel
#

its at the very top

#

like one of the first things written

#

whereas the tweening is down the bottom

#

the tween is ruining it

brave jolt
#

that's just where you're starting vs ending

craggy hazel
#

yeah so what im saying is

#

that top part

#

follows whereever the player is facing

brave jolt
#

but it should still be at the front of the HRP no?

#

okay

#

so your end goal works, yes?

craggy hazel
#

then what i was trying to do was add a tween that rotates it downwards

#

but the second the tween was added

#

it bugged

brave jolt
#

okay so

#

what worked then

#

do what worked rq

#

come back to me

#

no tween

craggy hazel
craggy hazel
brave jolt
brave jolt
craggy hazel
brave jolt
#

your origin is fine?

craggy hazel
#

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

brave jolt
#

yeah it's angles, angles do the orientation

brave jolt
craggy hazel
craggy hazel
brave jolt
brave jolt
#

so, your end goal is straight, left to right, or what

craggy hazel
brave jolt
#

top left to bottom left is what i assume

craggy hazel
#

a slash downwards

brave jolt
#

okay

brave jolt
#

makes sense

#

so you need to change your origin orientation

#

where it starts

craggy hazel
#

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

brave jolt
#

it is rotating 90 degrees though

craggy hazel
#

its not rotating the right way, no

#

i was gonna change that but i wanted to fix this first

brave jolt
#

lemme get a reference rq

#

what axis is that?

#

x y or z

#

that you're changing in the vid?

craggy hazel
#

we NEED the tweening to understand its meant to be locked to the hrp but im not sure how to write that

brave jolt
craggy hazel
#

x

brave jolt
#

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

brave jolt
#

so if you did 90 degrees z it would rotate downward 90 degrees as the part did

craggy hazel
#

i get whatchu mean

brave jolt
#

if you want it out and down, you'd just change the position forward a bit more

hard basinBOT
#

studio** You are now Level 15! **studio

craggy hazel
#

but then isnt it still concerning that its not following the hrp

brave jolt
#

it is

#

it is EXACTLY following the hrp

#

it's not concerning

#

test it, you'll see

craggy hazel
#

so just

#

change the axis

brave jolt
#

yep

craggy hazel
#

of the tween

brave jolt
#

90 degrees z

#

so it'd be 0, 0, math.rad(90)

craggy hazel
#

my fault

#

it was on

brave jolt
#

nw nw

craggy hazel
#

the z axis

#

not x

brave jolt
#

was it?

craggy hazel
#

yeah

brave jolt
#

then it's likely rotated by default

craggy hazel
brave jolt
#

check your effects rotation

#

or whatever it is

craggy hazel
#

the model has -90

brave jolt
#

LOL

craggy hazel
#

the part has 90

brave jolt
#

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

brave jolt
craggy hazel
#

yeah yeah i feel you

brave jolt
#

see if it works

#

it should

craggy hazel
#

alright

#

wouldnt that not change anything though?

brave jolt
#

angles are a bitch

brave jolt
craggy hazel
#

cause the orientation was already set at the top

brave jolt
#

it could only be going off the model/part angle

#

so it'd be (-?)90

craggy hazel
#

alright

#

i made them both 0,0,0

brave jolt
#

test it

#

if you want it rotated, just do a different axis

craggy hazel
#

same thing

brave jolt
#

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

craggy hazel
#

brother...

brave jolt
#

it'll work eventually

craggy hazel
#

why does the task.wait have an error

brave jolt
#

you didnt end the }

#

silly goose!

craggy hazel
#

then it does that

brave jolt
#

wait a minute

craggy hazel
#

nvm

#

im just

brave jolt
#

you do })

#

anyways

craggy hazel
#

special

#

:sb:

brave jolt
#

wait a minute

craggy hazel
#

😭*

brave jolt
#

could you try: 0, 90, 0

#

with rad on 90

#

or is it degrees

craggy hazel
#

im confused

#

what do i write?

#

so just put

brave jolt
#

Vector3.new(0, math.rad(90), 0)

craggy hazel
#

0, math.rad 90, 0

#

alright'

brave jolt
#

your problem is it's just rotated 90 degrees to the left

#

so just keep rotating 90 degrees positive or negative until it works

craggy hazel
#

its still

#

giving me that same issue

brave jolt
#

same spot?

#

or an error

craggy hazel
#

yeah

#

same spot

brave jolt
#

exact same?

craggy hazel
#

yep

brave jolt
#

change rad to deg

#

in math.rad

#

im silly sorry

craggy hazel
#

woah wtf

#

😭

#

icl

brave jolt
#

radians = part of a circle where the radius is equal to the arc of the circle.
degrees = angle

craggy hazel
#

it just gave me

#

prolly one of the coolest errors

#

ive ever seen

brave jolt
#

oh?

brave jolt
#

did it go above your head

craggy hazel
#

check this out

#

not even close

#

loading...*

brave jolt
#

nw

craggy hazel
brave jolt
#

wait that's so damn cool

#

how did that even happen

#

what

craggy hazel
#

ikr 😭

brave jolt
#

you're doing 0, math.deg(90), 0?

craggy hazel
#

yep

brave jolt
#

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

brave jolt
brave jolt
brave jolt
craggy hazel
brave jolt
#

so math.deg(90), 0, 0

craggy hazel
#

but obv i wanna fix this

#

so im just copying the script

#

duping*

brave jolt
#

yeah

#

lemme know where it puts it with x

craggy hazel
#

though for some reason now

#

it wont work at all

brave jolt
#

hmm?

#

it's not rotating?

craggy hazel
#

i think i fixed it

#

there we go

brave jolt
#

is it forward or to the side?

brave jolt
brave jolt
#

use math.deg always

brave jolt
#

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

craggy hazel
#

lemme try that

craggy hazel
#

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

brave jolt
#

what's the other error

#

X is probably wrong them if it spazzed out

#

try Z?

craggy hazel
brave jolt
#

hm..

craggy hazel
craggy hazel
brave jolt
#

i'd just keep messing with the values and swapping axis between x and z

#

try on Z and not on X

craggy hazel
#

okay so

#

it went downwards

#

but

brave jolt
#

it rotated left?

craggy hazel
#

it gave me this error i had at the very beginning when i tried fixing it myself

craggy hazel
brave jolt
#

try this then:
x, y, math.rad(90)

#

@craggy hazel

craggy hazel
#

.deg?

brave jolt
#

yes

#

oops

#

i dont do much in the way of orientation tweening so im purely going off logic n such 😭

craggy hazel
craggy hazel
#

except

brave jolt
craggy hazel
#

all around

craggy hazel
brave jolt
#

that's what ucan interpret

#

u can do 45?

craggy hazel
#

nah like

#

its not doing the up and down

craggy hazel
slim viper
#

i helped lot

#

ngl

brave jolt
#

and goes down

#

to the bottom

craggy hazel
#

its not doing that

brave jolt
#

hmm

craggy hazel
#

its doing exactly that

#

but

#

instead of around the floor of the player

#

its like a 360 sphere

brave jolt
#

this seems correct

craggy hazel
brave jolt
# craggy hazel

this does it at the position the player was at when they did it

#

which is correct

#

it's doing what it should

craggy hazel
#

oh nah

#

wasnt that

brave jolt
#

whatever it was worked

#

LOL

slim viper
#

euler angles

#

real thing

craggy hazel
brave jolt
#

yeah

craggy hazel
brave jolt
#

or just less down?

craggy hazel
#

you can see

#

in the video

#

it flicks to the right

#

it doesnt go

#

straight down

brave jolt
#

is that not an effect thing?

#

thought it was

craggy hazel
#

not to mention

#

one slight angle change

#

and the whole thing breaks

#

meaning something is genuinely wrong within the code

brave jolt
#

it's just tweening

craggy hazel
#

its the tweening yes

brave jolt
#

if anything, it could be the start position

craggy hazel
#

i dont think it is

#

rewatch the video

#

you can see

#

it starts out straight

#

kicks out to the right

#

then lines back up

brave jolt
#

hm

#

but we don't mess with other angles

#

oh

#

wait

#

ah

craggy hazel
#

mid way through the impact frame, but you can see its straight

brave jolt
#

it's because of either hrp x or y

craggy hazel
#

then kicks out

brave jolt
#

did 0, 0, math.deg(45), work?

craggy hazel
#

then straightens back up

brave jolt
#

you could do x, 0, math.deg(45)

craggy hazel
#

like i mntioned

#

one slight change in the angle

#

and it completely breaks

brave jolt
#

wait wait wait

#

pause

#

step back a second

#

0, 0, math.deg(45) causes an error?

craggy hazel
#

no

brave jolt
#

okay

craggy hazel
#

it causes it to spase out

brave jolt
#

so the weird spazzy

#

okay cool

#

good

craggy hazel
#

yeah

brave jolt
#

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

craggy hazel
#

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

brave jolt
craggy hazel
#

itll just spase out

#

spas*

#

yeah

brave jolt
#

would x, 0, math.deg(90)

#

?

craggy hazel
#

just spazzes out

craggy hazel
#

idk what we did

#

but it wont go back to that

#

straight slash

brave jolt
#

x, y, math.deg(90) too?

craggy hazel
#

yes

brave jolt
#

what

craggy hazel
#

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

brave jolt
#

that dont make no sense

craggy hazel
#

i know

brave jolt
#

did u revert smth else on accident

craggy hazel
#

want me to ss

#

screen share*

brave jolt
#

send a copy of the game in team create so i can mess w it?

craggy hazel
craggy hazel
brave jolt
#

sure

craggy hazel
#

game has a bunch of assets for coms

#

so yk

brave jolt
#

nw

#

just need whatever it uses

craggy hazel
#

how would i send off the script?

brave jolt
#

put them both in a folder

#

export selection

craggy hazel
brave jolt
craggy hazel
#

the vfx

brave jolt
#

try putting into a model

craggy hazel
#

nope

brave jolt
#

what is your studio

#

😭

craggy hazel
#

it wont let me export

#

what has it got to do with the studio? 💀

#

im exporting just the script

#

thats it all opened up

brave jolt
#

if the former, i stand by my point: your roblox studio is being weird

craggy hazel
#

i tried with the local script

#

both same error

#

even the model

brave jolt
#

yeah then it's weird

craggy hazel
#

check dms

#

look at all the shit you could have taken