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

Frame doesn't Tween When I touch a part?

I made a script so when you touch a part, a frame tweens to your screen. But this doesn't happen.

local Frame = game.StarterGui.CodeDoorGUI.Frame


workspace.Part.Touched:Connect(function(hit)
	local H = hit.Parent:WaitForChild("Humanoid",1000000000000000)
	if H then
		Frame:TweenPosition(UDim2.new(0.257,0,0.264,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.8,true)
	end
end)

1 comment

0

you didn't set the tween style

1 answer

✓ Accepted answer

I think you need to write this above the Frame:TweenPosition:

Frame.Position = UDim2.new(0.257,0,-1((for example)),0)

OR

local Frame = game.Players.LocalPlayer.PlayerGui.CodeDoorGUI.Frame

workspace.Part.Touched:Connect(function(hit)
local H = game.Players:GetPlayerFromCharacter(hit.Parent)
if H then
Frame.Position = UDim2.new(0.257,0,-1((for example)),0)
Frame:TweenPosition(UDim2.new(0.257,0,0.264,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.8,true)
end
end)

OR


workspace.Part.Touched:Connect(function(hit)
local H = game.Players:GetPlayerFromCharacter(hit.Parent)
local Frame = H.PlayerGui.CodeDoorGUI.Frame
if H then
Frame.Position = UDim2.new(0.257,0,-1((for example)),0)
Frame:TweenPosition(UDim2.new(0.257,0,0.264,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.8,true)
end
end)

i don't think this would work because I haven't tested it yet :]

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