Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

tween error | attempt to index boolean with 'Play' ?

Alright so i've browsed a bit after this issue and the only thing i could find was to rename my "JoinScreenAnimation" and that didn't work. Then a second issue where it doesnt disable the chat but it does disable the leaderboard.Here's my code:

local ReplicatedFirst = game:GetService("ReplicatedFirst")
ReplicatedFirst:RemoveDefaultLoadingScreen()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false) --this does disable the leaderboard
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false) --this does not disable the chat

wait(10)
if not game:IsLoaded() then
	game.Loaded:Wait()
end

script.Parent.JoinScreen.Loading.Visible = false
script.Parent.JoinScreen.Loaded.Visible = true
wait(0.5)
local JoinScreenAnimation = script.Parent.JoinScreen.TitleCard:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 2, true )

JoinScreenAnimation:Play() --[[error Players.Pitched_mobile.PlayerGui.ScreenGui.ScreenHandler:16: attempt to index boolean with 'Play']]

JoinScreenAnimation.Completed:Connect(function()
	wait(2)
	script.Parent.JoinScreen:Destroy()
	script.Parent.Select.Visible = true
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,true)
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
end)

1 comment

0

Must be something stupid im overlooking here

1 answer

✓ Accepted answer

:TweenPosition returns a boolean of whether the GUI will be tweened or not. You don't need to use :Play() with :TweenPosition(), as it will attempt to tween the GuiObject regardless. You should try using TweenService:Create() instead.

local JoinScreenAnimation = TweenService:Create(script.Parent.JoinScreen.TitleCard, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Position = Udim2.new(0, 0, 0, 0)
JoinScreenAnimation:Play()

4 comments

0

oh so it will just play

0

Yes, but you won't be able to have the .Completed event if my memory is correct

0

yeah gotcha

1

yeah gotcha i just fixed it with adding a Wait()

This discussion is preserved as it was. New answers, comments, and votes are closed.