Main Idea:
You are saying you want a gui to appear saying that you have received money. That is your question, but your script could be so much more simple and look way more professional. (This is to Help for the Gui, not the button, since you didnt provide if the button has a surface gui with a Button, or a Click Detector, either way the script should work.)
Lets Begin
First go into Starter Gui and insert a Screen Gui. Insert a Frame Inside of the Screen Gui. Now insert a Text Box inside of the frame. Inside of the screen gui, insert a Local Script. Before we worry about the code, we will get your Text in the Right position. First change the size of your Frame and Text Box until you are happy with your results. Change the Text inside of the text box to You have received $MoneyNumberHere. Now to get the position of your frame in the center of your screen, change the variables to these {0.5,0},{0.5,0}. Now take the size of your frame, and divide the second number by 2, and the 4th number by 2, and put a negative sign in front of them. example: if my size is
{0,150},{0,200}
then my position would be:
{0.5,-75},{0.5,-100}
now your frame should be dead center.
Now will will learn about the Tween Service. Now, right down the position of your frame then, change the first 0.5 in the position to 10. Now we will finally get into the script.
Lets Define some variables first:
local frame = script.Parent.Frame
local button = game.Workspace.Button
Now we will begin working on the main script:
local frame = script.Parent.Frame
local button = game.Workspace.Button
function addMoney()
frame:TweenPosition(UDim2.new(0.5,-75,0.5,-100),'Out','Quint',1)
wait(3)
frame:TweenPosition(UDim2.new(10, -75, 0.5, -100),'In','Quint',1)
end
button.MouseButton1Click:Connect(addMoney)
Wiki link to easing styles:http://wiki.roblox.com/index.php?title=API:Enum/EasingStyle
if you need anything else, just comment on my answer.
1 comment
instead of startergui you should do game.Players.LocalPlayer.PlayerGui, remember that this is happening to the local player only so you should be doing it only to their gui..............startergui is when you want to make changes for all players when they respawn