✓ Accepted answer
GENERAL PRACTICE
The "Out / In" and "Bounce" are Enum Properties, so a String will work sometimes, but not for all players.
ISSUES
The TweenPosition (UDim2.new(5, 0.5,0, 0)) moves the frame 5 times its current placement on the x-axis plus an additional 0.5 pixel offset, which based on the size of your frame, would move it out of the picture.
Secondly, You used TweenPosition for the same exact location, so the frame would not move to a new location after the first tween.
Based on comments in the chat, you can set the position to the below coordinates for it to move to the near center of the screen. If you check the frame's original position as a local variable you can preset where it will move back to.
I cannot see what the connection of your function is or where the local sound is, so you will have to update these from the below script.
Revised Local Script
local plr = game:GetService("Players").LocalPlayer
local sound = script:WaitForChild("Sound")
local ui = plr:WaitForChild("PlayerGui"):WaitForChild("Radio"):WaitForChild("UI"):WaitForChild("loud"):WaitForChild("move")
local position = ui.Position
script.Parent.Activated:Connect(function()
if sound.PlaybackLoudness >= 400 then
game:GetService("ReplicatedStorage"):WaitForChild("TooLoud"):FireServer(plr)
ui.Visible = true
ui:TweenPosition(UDim2.new(0.083, 0, 0, 0), Enum.EasingDirection.In, Enum.EasingStyle.Bounce, 2, true)
wait(5)
ui:TweenPosition(position, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 2, true)
wait(2)
ui.Visible = false
end
end)
1 comment
im going to make it Instance.new a frame later