Tween not playing

Hello everyone! I am trying to make a command when you say !Handto, a Frame will show up playing a tween. But its not it’s playing and the Frame won’t pop up.

Script
local GroupId = 7446763 
local MinimumRank = 4

game.Players.PlayerAdded:COnnect(function(PLayer)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGrouo(GroupId) >= MinimumRank then
			local Command = PLayer.PlayerGui.HandtoGui.Frame
			if Message == "!Handto" then
				wait(1)
				Command:TweenPosition(UDim2.new(0.5, 0,0.1, 0), 'Out', 'Bounce', '1')
			elseif Message == "!Close" then
				Command:TweenPosition(UDim2.new(0.5, 0,-1, 0), 'Out', 'Bounce', '1')
			end
		end
	end)
end)

(I don’t know how to use tweens)

2 Likes

Connect is misspelled in line 4 and so is Player in line 7

I’ve fixed it, but it still doesn’t work.

Typo here:

This should be an integer, just remove the quotes.

You also have to add :Play() at the end of your tweens.

This, in addition to what @Ozmius said should fix it.

So, I did everything. but it still doesn’t work. Here’s the script, I might’ve made a typo again :expressionless:

local GroupId = 7446763 
local MinimumRank = 4

local Commands = script.Parent.Frame

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			local Command = Player.PlayerGui.HandtoGui.Frame
			if Message == "!Handto" then
				Commands:TweenPosition(UDim2.new(0.5, 0,0.1, 0), 'Out', 'Bounce', 1)
				:Play()
			elseif Message == "!Close" then
				Commands:TweenPosition(UDim2.new(0.5, 0,-1, 0), 'Out', 'Bounce', 1)
				:Play()
			end
		end
	end)
end)
1 Like

Just add :Play() to the end of these lines like I did in this example, they should be on the same one. If this doesn’t solve it, are there any output errors?

I’ve tried doing that, but didn’t work. Also, there aren’t any output errors. Is the script suppose to be in a local script??

I think you should try using remote events for this since it’s an UI.

Whenever I tween a frame it looks like this;

Frame:TweenPosition(UDim2.new(.5,0,.5,0), "Out", "Quad", 1, true)

If your frame isn’t being tweened the problem could just be that you need to wait until the ui exists. Also from what I know I always tween frames using localscripts. It may not work with server scripts.

Oh wait, right here, Command

It should be Commands

You should also add the output or developer console so we can see any errors.

1 Like

Problem 1: You named your variable ‘Command’, but you try to tween ‘Commands’ when it has to be the same name

Problem 2: You added Play() when you don’t need to add Play() to TweenPosition(), that command runs on it’s own, since it’s a function being called.

Okay, @7z99 told me to use “:Play()”.

Oh, that’s right, I forgot haha.

You misspelled Group to Grouo.

I already know. i fixed that error already.

This is the script now:

local GroupId = 7446763 
local MinimumRank = 4

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Player:GetRankInGroup(GroupId) >= MinimumRank then
			local Command = Player.PlayerGui.HandtoGui.Frame
			if Message == "!Handto" then
				Command:TweenPosition(UDim2.new(0.5, 0,0.1, 0), 'Out', 'Bounce', 1, true)
			elseif Message == "!Close" then
				Command:TweenPosition(UDim2.new(0.5, 0,-1, 0), 'Out', 'Bounce', 1, true)
			end
		end
	end)
end)

Are you sure there aren’t any errors? Adding :Play() to the end of the tween should have caused an error.

I already removed the :Play().

1 Like

I assume your doing this in a server script. At the part of tweening, change the script to local script, because GUI ONLY TAKES EFFECT on local, bot server.