So I’ve been making a minigame test and I’ve came across an issue. The tween won’t play and there are no errors. So I don’t know what’s the issue. Here’s the video.
Script
local Gui = script.Parent.Parent
local Holder = Gui:WaitForChild("Holder")
local CircleToMove = Holder:WaitForChild("MainCircle")
local CircleTrigger = Holder:WaitForChild("CircleTrigger")
local CircleStart = Holder:WaitForChild("CircleStart")
local CircleEnd = Holder:WaitForChild("CircleEnd")
local TweenService = game:GetService("TweenService")
local Events = game.ReplicatedStorage.Events
local MinigameStart = Events:WaitForChild("CageMinigameStart")
local UserInputService = game:GetService("UserInputService")
local ImageLabel = Holder:WaitForChild("Icon")
local CircleCollisions = false
local Lives = 3
local Interactions = 0
local tween1 = TweenService:Create(CircleToMove, TweenInfo.new(1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut), {Position = CircleStart.Position})
local tween2 = TweenService:Create(CircleToMove, TweenInfo.new(1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut), {Position = CircleEnd.Position})
function collidesWith(gui1, gui2) -----some parameter you can put your GUI1 and GUI2 in
local gui1_topLeft = gui1.AbsolutePosition
local gui1_bottomRight = gui1_topLeft + gui1.AbsoluteSize
local gui2_topLeft = gui2.AbsolutePosition
local gui2_bottomRight = gui2_topLeft + gui2.AbsoluteSize
return ((gui1_topLeft.x < gui2_bottomRight.x and gui1_bottomRight.x > gui2_topLeft.x) and (gui1_topLeft.y < gui2_bottomRight.y and gui1_bottomRight.y > gui2_topLeft.y)) -- return their values
end
function bump()
local random_rotation
local ogsize = ImageLabel.Size
if math.random(1, 2) == 1 then
random_rotation = -30
else
random_rotation = 30
end
ImageLabel.Rotation = random_rotation
ImageLabel.Size = ogsize + UDim2.new(0,20,0,20)
local tween = TweenService:Create(ImageLabel, TweenInfo.new(0.3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Rotation = 0})
local tween2 = TweenService:Create(ImageLabel, TweenInfo.new(0.3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Size = ogsize})
tween:Play()
tween2:Play()
end
MinigameStart.OnClientEvent:Connect(function()
Gui.Enabled = true
Interactions = 0
Lives = 3
Holder.Position = UDim2.new(0.5,0,-0.3,0)
local tween = TweenService:Create(Holder, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Position = UDim2.new(0.5,0,0.5,0)})
tween:Play()
tween.Completed:Wait()
CircleCollisions = true
end)
UserInputService.InputBegan:Connect(function(input, engine_processed)
if engine_processed then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.KeyCode == Enum.KeyCode.Space then
if CircleCollisions then
if collidesWith(CircleToMove, CircleTrigger) then
local tween = TweenService:Create(CircleTrigger, TweenInfo.new(0.3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Size = CircleTrigger.Size + UDim2.new(-0.025,0,0,0)})
tween:Play()
Interactions += 1
bump()
else
Lives -= 1
print(Lives)
end
end
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if Lives <= 0 then
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end
if Interactions >= 8 then
--error over here
CircleCollisions = false
tween1:Pause()
tween2:Pause()
task.wait(0.5)
local tween3 = TweenService:Create(Holder, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {Position = UDim2.new(0.5,0,-0.3,0)})
tween3:Play()
tween3.Completed:Wait()
Gui.Enabled = false
end
end)
while wait() do
if CircleCollisions then
tween1:Play()
tween1.Completed:Wait()
tween2:Play()
tween2.Completed:Wait()
end
end