I got two scripts, both with the same code and such, and yet one of them doesn’t work. It’s a tween function I’m trying to do. Here’s the main code:
local function Tween(Object,Value)
local OutTween = ts:Create(Object,inf,{ImageTransparency = Value})
OutTween:Play()
end
Tween(obj,value) --- this is just an example but you get the picture
Then here are the two scripts:
NOT WORKING
local ts = game:GetService('TweenService')
local button = script.Parent.leaveButton
local tweeninf = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local function Tween(Object,Value)
local OutTween = ts:Create(Object,tweeninf,{ImageTransparency = Value})
OutTween:Play()
end
button.MouseEnter:Connect(function()
script.Parent.Static:Play()
local Tween = ts:Create(script.Parent.Static, TweenInfo.new(1, Enum.EasingStyle.Linear), {Volume = 1})
Tween:Play()
Tween(button.ImageLabel,0)
end)
button.MouseEnter:Connect(function()
local Tween = ts:Create(script.Parent.Static, TweenInfo.new(1, Enum.EasingStyle.Linear), {Volume = 0})
Tween:Play()
Tween.Completed:Wait()
script.Parent.Static:Stop()
Tween(button.ImageLabel,1)
end)
WORKING
local ts = game:GetService("TweenService")
local inf = TweenInfo.new(0.5,Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local function Tween(Object,Value)
local OutTween = ts:Create(Object,inf,{ImageTransparency = Value})
OutTween:Play()
end
local part = game.Workspace.improvedtext
local canhit = true
local chapter = script.Parent.chapter
local info = script.Parent.info
chapter.AnchorPoint = Vector2.new(0, 0)
chapter.Position = UDim2.new(0.277, 0, 0.236, 0)
info.AnchorPoint = Vector2.new(0, 0)
info.Position = UDim2.new(0.356, 0, 0.362, 00)
game.ReplicatedStorage.Touch.OnClientEvent:Connect(function()
if canhit == true then
canhit = false
script.Parent.Visible = true
Tween(script.Parent.chapter,0)
chapter:TweenPosition(UDim2.new(0.277, 0,0.166, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad)
wait(0.25)
Tween(script.Parent.info,0)
info:TweenPosition(UDim2.new(0.356, 0,0.296, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad)
wait(4)
Tween(script.Parent.chapter,1)
chapter:TweenPosition(UDim2.new(0.277, 0, 0.236, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad)
Tween(script.Parent.info,1)
info:TweenPosition(UDim2.new(0.356, 0, 0.362, 00), Enum.EasingDirection.Out, Enum.EasingStyle.Quad)
canhit = true
end
end)
It errors both at line 14 and line 22 (NOT WORKING) code.
I don’t know why it’s like that, if anyone can help me that would be greatly appreciated, ty!