Smack Brand new to coding after almost a year break. Somehow forgot how to tween parts as such. Pretty much what I am trying to do is make one part smoothly transition into looking like another part, I kind of forgot everything. I’ve watched a couple tutorials but none touch on changing a parts orientation ig. I have some type of code below and a picture for what I want to achieve. I promise anything is helpful.
local FISHING_ROD_BENT = workspace.FISHING_ROD_STATE_BENT
local cf = game:GetService("TweenService")
localrs = game:GetService("RunService")
local function ROD_BEND()
local ROD_BEND_ORIENTATION = FISHING_ROD_BENT:GetChildren().Position
local info = TweenInfo.new(5, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0,false)
local tween = cf:Create(FISHING_ROD, info, {Position = ROD_BEND_ORIENTATION})
tween:Play()
print("ROD BEND")
end
wait(5)
ROD_BEND() ```
VVV - Picture Link
https://ibb.co/B4kJTpZ
You can’t tween models directly. You’ll either have to create a PrimaryPart and weld everything to it and tween it or iterate through every part and change it with a loop. (which is what you’re doing, I assume).
Use task.wait() instead of wait().
Also, :GetChildren() returns a table of the children of the model, so you can’t get the Position property from it.
For the below code to work, the parts of both the fishing rods must be named the same.
--[[ !WARNING!
This probably won't work because the parts might not be named the same.
]]--
local FISHING_ROD_BENT = workspace.FISHING_ROD_STATE_BENT
local cf = game:GetService("TweenService")
local function ROD_BEND()
for _, part in pairs(FISHING_ROD_BENT:GetChildren()) do
local orientation = part.Position
cf:Create(FISHING_ROD[part.Name], TweenInfo.new(5, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0,false), {Position = orientation}):Play()
end
end
task.wait(5)
ROD_BEND()