#Model TweenService Problem
1 messages · Page 1 of 1 (latest)
did you weld the parts to the primarypart
You should probably use aligne position and weld all your model to a handler point
or you can use a hinge as a servo
If you realy want to tween your model you will need to use some tricks like Using a Vector3Value and tween it and then with a loop apply the vector3 to your model with :PivoteTo
i welded all the parts toegether
by making unions
and using weld contraints after
the primary part of the model is "black"
and its all the black parts
so what youre saying it that i should add a part, weld it to the model
handler part
lika a part to the rotation point
then set it to primary part and try to use PivoteTo
imma try that rn
or if you want to do something better you use a hinge constraint
ye
sry
its a instance
only been scripting for 3 weeks
ill make research then
its just rbx physic system
thx
local Folder = workspace.SpecialObbies.NoNameObby["Hell (Made by NoName!)(Also please write your obby's name)"]
local TweenService = game:GetService("TweenService")
for _, axe in Folder:GetChildren() do
if axe.Name == "axe" and axe:IsA("Model") then
local pivotPart = axe:FindFirstChild("Handler")
if pivotPart then
axe.PrimaryPart = pivotPart
else
warn("No Handler part found in axe model: " .. axe.Name)
continue
end
local startPivot = axe:GetPivot()
local leftCF = startPivot * CFrame.Angles(0, math.rad(-90), 0)
local rightCF = startPivot * CFrame.Angles(0, math.rad(90), 0)
local cfValue = Instance.new("NumberValue")
cfValue.Value = -45
cfValue.Changed:Connect(function(newAngle)
local radians = math.rad(newAngle)
local newCF = startPivot * CFrame.Angles(0, radians, 0)
axe:PivotTo(newCF)
end)
local tweenInfo = TweenInfo.new(
2,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
-1,
true,
0
)
local tween = TweenService:Create(cfValue, tweenInfo, {
Value = 45
})
tween:Play()
end
end
this my code and it doesnt work
someone help
look at the video
its an axe
i want to make it swing from left to right
continuelsy
but instead of that its doing that
gimme
pls
someone told me to animate it
is it the right way of doing it ??
idc actually just give me this pls
no
WHY
i was saying no to this
Ive been for 2 hours
local TweenService = game:GetService("TweenService")
local model = script.Parent
local proxy = Instance.new("CFrameValue")
proxy.Value = model:GetPrimaryPartCFrame()
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true)
local currentPosition = model.PrimaryPart.Position
local goalCFrame = CFrame.new(currentPosition) * CFrame.Angles(0, 0, math.rad(-50))
local tween = TweenService:Create(proxy, tweenInfo, {Value = goalCFrame})
proxy:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(proxy.Value)
end)
tween:Play()
this is my script
do you understand it?
local TweenService = game:GetService("TweenService")
local Folder = workspace.SpecialObbies.NoNameObby["Hell (Made by NoName!)(Also please write your obby's name)"]
for i, model in Folder:GetChildren() do
local proxy = Instance.new("CFrameValue")
proxy.Value = model:GetPrimaryPartCFrame()
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true)
local currentPosition = model.PrimaryPart.Position
local goalCFrame = CFrame.new(currentPosition) * CFrame.Angles(0, 0, math.rad(-50))
local tween = TweenService:Create(proxy, tweenInfo, {Value = goalCFrame})
proxy:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(proxy.Value)
end)
tween:Play()
end
you can replace this with your original script
lemme try
so like
with that script
do i need to weld all the parts toegether
or have a "handler part" to make the rotation point ??
or do i only need to have the model
local TweenService = game:GetService("TweenService")
local Folder = workspace.SpecialObbies.NoNameObby["Hell (Made by NoName!)(Also please write your obby's name)"]
for i, model in Folder:GetChildren() do
local currentPosition = model.PrimaryPart.Position
local proxy = Instance.new("CFrameValue")
proxy.Value = CFrame.new(currentPosition) * CFrame.Angles(0, 0, math.rad(50))
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true)
local goalCFrame = CFrame.new(currentPosition) * CFrame.Angles(0, 0, math.rad(-50))
local tween = TweenService:Create(proxy, tweenInfo, {Value = goalCFrame})
proxy:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(proxy.Value)
end)
tween:Play()
end
top is the PrimaryPart and is located at the very top of the axe (turning point)
doesnt need to be named top
okok thx
try this script and tell me if it works
nice
cause there are a lot of things insside my folder
why not ?
its the best thing in the world
cause it makes it harder for people to read
if true then
--code
end
if not true then return end
--code
you see
it does the same thing but is much more readable and you dont nest
nicee
thx for everything
npnp
if you wanna like learn more about having clean code I can recommend this video to you
https://www.youtube.com/watch?v=CFRhGnuXG-4&t=19s
I'm a Never Nester and you should too.
Access to code examples, discord, song names and more at https://www.patreon.com/codeaesthetic
Correction: At 2:20 the inversion should be "less than or equal", not "less than"
or overall the channel is good
thx
so like
cause i already need to add things to you code
i have a question before making the changes
i could replace that :
with that :
@clever socket
????
its the if statement that changes
btw
model.Name ~= "axe"
** You are now Level 7! **
crazy
works again
th
yk what continue does?
continue the code
not really
continue is like return but it continues the loop for the rest of the objects in the array
alr
in the end
i havent used ur thing
doesnt work
too lazy to understand why
here's my code tho
oh wait not finished
nvm the pause part is not working
is it working?