Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tween Not Working-Unable to Cast Value to Function?

Asked by 3 years ago

My GUI tween keeps coming up with the error Unable to Cast Value to Function. Any help to fix this issue would be much appreciated.

Here is my code:

local creditsButton = script.Parent.Parent:WaitForChild("CreditsButton")
local changelogButton = script.Parent.Parent:WaitForChild("ChangelogButton")
local playButton = script.Parent.Parent:WaitForChild("PlayButton")
local gameTitleLabel = script.Parent.Parent:WaitForChild("GameTitleLabel")


local function hidePlayButtonTween()

    playButton:TweenPosition(

        UDim2.new(1, 0, 0.326, 0), --End Pos
        "Out", --Easing Direction
        "Sine", --Easing Style
        1, --Time
        false, --Override Other Tweens
        false --Callback
   )
end



creditsButton.MouseButton1Up:Connect(hidePlayButtonTween)
creditsButton.TouchTap:Connect(hidePlayButtonTween)
0
Nerd. 25MouseSensitivity 63 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

The last parameter for TweenPosition is looking for a function, you gave it a boolean value. nil would be correct, I believe. nil tells the TweenPosition method that there is no callback function

Ad

Answer this question