I’m trying to make this part go straight down but for some reason it goes to the right every time I click it.
Explorer :
LocalScript (Inside Menu)
--// variables
local Menu = script.Parent
local OptionsButton = Menu.Options
local PlayButton = Menu.Play
local xButton = Menu.x
local Title = Menu.title
local DropButton = Menu.Drop
local Status = Menu.status
local isPlaying = false
local drop = game.ReplicatedStorage:WaitForChild("drop")
--// main
PlayButton.MouseButton1Click:Connect(function()
xButton.Visible = false
PlayButton.Visible = false
OptionsButton.Visible = false
Title.Visible = false
isPlaying = true
Status.Visible = true
DropButton.Visible = true
end)
DropButton.MouseButton1Click:Connect(function()
if isPlaying == true then
drop:FireServer()
end
end)
Tween (inside the yellow piece / Coin)
local Part = script.Parent
local TweenService = game:GetService("TweenService")
local Pos = Vector3.new(5.5, 24, 1) -- Change this to the position you want part to move to
local drop = game.ReplicatedStorage:WaitForChild("drop")
local Moving_Info = TweenInfo.new(
1, --the amount of seconds you want it to take
Enum.EasingStyle.Back,
Enum.EasingDirection.InOut,
999, --The amount of time you want it to repeat
true, --Whether you want it to reverse back to the original position when it's done
0 -- how much time should delay between each repitition
)
local Drop_Info = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
1,
false,
0
)
local dropPos = Vector3.new(Part.Position.X, Part.Position.Y-7, Part.Position.Z)
local tween = TweenService:Create(Part, Moving_Info, {Position = Pos})
tween:Play()
drop.OnServerEvent:Connect(function()
local stoppedpos = Part.CFrame
tween:Cancel()
wait(1)
Part.CFrame = stoppedpos
local tween2 = TweenService:Create(Part, Drop_Info, {Position = dropPos})
tween2:Play()
end)
as you can see with my mouse movements, i want it to go straight down from the point when i click the buton, but rather it chooses to go back to where the origin of the animation is and go down 7 studs there