function visuals.move_tile (tile, goal, mode)
local Ay,Ax = visuals.get_coords(goal)
local By,Bx = visuals.get_coords(tile)
local player = game.Players.LocalPlayer
local frame = player.PlayerGui.Board.Frame
local Visual_Folder = frame.Tiles_VISUAL
local GridLayout = Button_Folder:WaitForChild("GridLayout")
local Agoal = {}
local Bgoal = {}
Agoal.Position = UDim2.new(GridLayout.CellSize.X.Scale * (Ax-1),0,GridLayout.CellSize.Y.Scale * (Ay-1),0)
Bgoal.Position = UDim2.new(GridLayout.CellSize.X.Scale * (Bx-1),0,GridLayout.CellSize.Y.Scale * (By-1),0)
warn("Moved")
coroutine.wrap(function()
local move_tween = TS:Create(Visual_Folder:WaitForChild(tile), move_tween_info, Agoal)
move_tween:Play()
Visual_Folder[tile].Name = goal
end)()
if mode == "Swap" then
warn("Swapped")
coroutine.wrap(function()
local move_tween = TS:Create(Visual_Folder:WaitForChild(goal), move_tween_info, Bgoal)
move_tween:Play()
Visual_Folder[goal].Name = tile
move_tween.Completed:Connect(function()
print('Swap completed')
end)
end)()
end
print(Visual_Folder[tile].Name)
print(Visual_Folder[goal].Name)
end
The names of the tiles print correctly, it feels like its some certain tiles that dont swap. It's not anything with tweens being interrupted due to swapping too fast, I can wait forever before swapping two tiles and nothing changes.
Also, if I try to swap tile A to tile B, it may not do anything. But if I instead do tile B to tile A, it does swap. Then I can swap them back and forth but never from A to B.
My laptop is about to die, someone please save me.
