I’m trying to make a textbutton that moves (only on the player’s screen) a couple seconds after the player joins the game. When I try this script, nothing happens. What am I doing wrong?
the PlayerAdded thing fires whenever a player joins the game, not just the local player. Additionally, the script usually runs too late to detect when the local player joins.
Looking at your use case, you could probably just remove the PlayerAdded bit entirely, and just have the middle code.
-- Services
local TweenService = game:GetService('TweenService') -- get the TweenService
-- The tweeninfo
local Info = TweenInfo.New(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,true) -- Create the tweeninfo for the TweenService
-- Your goal table
local Goal = { -- Create a table for the goal
['Position'] = UDim2.new(.5, 0, .3, 0)
}
game.Players.PlayerAdded:Connect(function(player)
print("Script works!")
wait(2)
local MyTween = TweenService:Create(script.Parent,Info,Goal)
MyTween:Play()
end)