What do you want to achieve? Keep it simple and clear!
Title
What is the issue? Include screenshots / videos if possible!
My script don’t works so idk what to do
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tryed add some variables, but this didn’t help
local SpinObject = script.Parent
local x = 0
while x == 0 do
SpinObject.Position += Vector3.new (0,0.1,0)
task.wait(0.05)
if SpinObject.Position == Vector3.new(-166.06, 2.929, 245.986) then
x = 1
end
end
while x == 1 do
SpinObject.Position -= Vector3.new (0,0.1,0)
task.wait(0.05)
if SpinObject.Position == Vector3.new(-166.06, 0.929, 245.986) then
x = 0
end
end
local SpinObject = script.Parent
local x = 0
while x == 0 do
print("first loop works good")
SpinObject.Position += Vector3.new (0,0.1,0)
task.wait(0.05)
if SpinObject.Position == Vector3.new(-166.06, 2.929, 245.986) then
x = 1
end
end
while x == 1 do
print("second loop works good")
SpinObject.Position -= Vector3.new (0,0.1,0)
task.wait(0.05)
if SpinObject.Position == Vector3.new(-166.06, 0.929, 245.986) then
x = 0
end
end
x is still 0 i think or it’s don’t detect when x value changes
local SpinObject = script.Parent
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tween = TweenService:Create(SpinObject, tweenInfo, {Position = Vector3.new(0, 2, 0)})
tween:Play()