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

GUI Tweening not working in .touched script when second tween is aded?

script.Parent.Touched:Connect(function(HIT)
	local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
		player.PlayerGui.ScreenGui.Shop.Visible = true
		local meep = game.Players.LocalPlayer.PlayerGui.ScreenGui.Shop
		meep:TweenPosition(UDim2.new(0.5,0,0.6,0),'In','Sine',0.5)
end)

script.Parent.TouchEnded:Connect(function(HIT)
	local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
	local meep = game.Players.LocalPlayer.PlayerGui.ScreenGui.Shop
	meep:TweenPosition(UDim2.new(1.5,0,0.6,0),'In','Sine',0.5)
		player.PlayerGui.ScreenGui.Shop.Visible = false
end)


the second tween messes everything up.

thisis a local script in a brick

1 comment

0

Can you please define what exactly is going wrong so we can properly answer the question?

1 answer

✓ Accepted answer

you dont want to the make the gui visible or invisible. Just make it start off of the screen.

script.Parent.Touched:Connect(function(HIT)
    local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
        local meep = game.Players.LocalPlayer.PlayerGui.ScreenGui.Shop
        meep:TweenPosition(UDim2.new(0.5,0,0.6,0),'In','Sine',0.5)
end)
 
script.Parent.TouchEnded:Connect(function(HIT)
    local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
    local meep = game.Players.LocalPlayer.PlayerGui.ScreenGui.Shop
    meep:TweenPosition(UDim2.new(1.5,0,0.6,0),'In','Sine',0.5)
end)

2 comments

0

Thanks!

0

no problem!

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