Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---- Main tool script (local script inside tool) ----
- local player = game.Players.LocalPlayer
- local PlayerGui = player:WaitForChild("PlayerGui")
- local WalletGui = PlayerGui:WaitForChild("WalletGui")
- local open = WalletGui:WaitForChild("Open")
- script.Parent.Activated:Connect(function()
- if open.Value == false then
- open.Value = true
- WalletGui.MainFrame:TweenPosition(UDim2.new(0.5, 0,0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1, true)
- else
- open.Value = false
- WalletGui.MainFrame:TweenPosition(UDim2.new(0.5, 0,1.27, 0), Enum.EasingDirection.In, Enum.EasingStyle.Back, 1, true)
- end
- end)
- script.Parent.Unequipped:Connect(function()
- open.Value = false
- WalletGui.MainFrame:TweenPosition(UDim2.new(0.5, 0,1.27, 0), Enum.EasingDirection.In, Enum.EasingStyle.Back, 1, true)
- end)
- ---- Money display script (script inside tool) ----
- local FormatNumber = require(game.ReplicatedStorage.Modules.FormatNumber)
- local formatter = FormatNumber.NumberFormatter.with()
- script.Parent.Equipped:Connect(function()
- local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
- print(player)
- if player then
- script.Parent.Handle.BillboardGui.TextLabel.Text = "$"..formatter:Format(player.Money.Value)
- player.Money:GetPropertyChangedSignal("Value"):Connect(function()
- script.Parent.Handle.BillboardGui.TextLabel.Text = "$"..formatter:Format(player.Money.Value)
- end)
- end
- end)
- ---- Main UI script (local script inside ScreenGui) ----
- local player = game.Players.LocalPlayer
- local FormatNumber = require(game.ReplicatedStorage.Modules.FormatNumber)
- local formatter = FormatNumber.NumberFormatter.with()
- local db = false
- script.Parent.MainFrame.CloseButton.MouseButton1Click:Connect(function()
- script.Parent.Open.Value = false
- script.Parent.MainFrame:TweenPosition(UDim2.new(0.5, 0,1.27, 0), Enum.EasingDirection.In, Enum.EasingStyle.Back, 1, true)
- end)
- for i, v in ipairs(script.Parent.MainFrame.Options:GetChildren()) do
- if v:IsA("TextButton") then
- if tonumber(v.Name) then
- v.MouseButton1Click:Connect(function()
- if db == false then
- db = true
- local response = game.ReplicatedStorage.DropCash:InvokeServer(tonumber(v.Name))
- print(response)
- if response ~= "success" then
- script.Parent.MainFrame.CustomAmountBox.Text = response
- end
- wait(1)
- db = false
- end
- end)
- end
- end
- end
- script.Parent.MainFrame.DropButton.MouseButton1Click:Connect(function()
- if script.Parent.MainFrame.CustomAmountBox.Text ~= "" then
- if db == false then
- db = true
- local response = game.ReplicatedStorage.DropCash:InvokeServer(script.Parent.MainFrame.CustomAmountBox.Text)
- print(response)
- if response ~= "success" then
- script.Parent.MainFrame.CustomAmountBox.Text = response
- end
- wait(2)
- db = false
- end
- end
- end)
- script.Parent.MainFrame.CustomAmountBox.FocusLost:Connect(function()
- if tonumber(script.Parent.MainFrame.CustomAmountBox.Text) then
- script.Parent.MainFrame.CustomAmountBox.Text = script.Parent.MainFrame.CustomAmountBox.Text
- else
- script.Parent.MainFrame.CustomAmountBox.Text = ""
- end
- end)
- script.Parent.MoneyDisplay.Text = "$"..formatter:Format(player.Money.Value)
- player.Money:GetPropertyChangedSignal("Value"):Connect(function()
- script.Parent.MoneyDisplay.Text = "$"..formatter:Format(player.Money.Value)
- end)
- ---- Pickup script (local script inside StarterPlayerScripts)
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local PlayerGui = player:WaitForChild("PlayerGui")
- local PickupGui = PlayerGui:WaitForChild("PickupGui")
- UIS.InputChanged:Connect(function()
- if mouse.Target then
- if mouse.Target.Parent:FindFirstChild("Handle") and mouse.Target.Parent.Name == "MoneyStack" then
- PickupGui.Enabled = true
- PickupGui.Adornee = mouse.Target.Parent.Handle
- else
- PickupGui.Enabled = false
- PickupGui.Adornee = nil
- end
- else
- PickupGui.Enabled = false
- PickupGui.Adornee = nil
- end
- end)
- UIS.InputBegan:Connect(function(key, g)
- if g then
- return
- end
- if key.KeyCode == Enum.KeyCode.E then
- if mouse.Target then
- local part = mouse.Target
- if part.Parent:FindFirstChild("Handle") and part.Parent.Name == "MoneyStack" then
- if part.Parent:FindFirstChild("Amount") then
- if (player.Character.HumanoidRootPart.Position - part.Position).Magnitude <= 25 then
- game.ReplicatedStorage.PickupCash:FireServer(part, part.Parent.Amount.Value)
- end
- end
- end
- end
- end
- end)
- ---- Event Handling script (script inside ServerScriptService) ----
- game.Players.PlayerAdded:Connect(function(player)
- local Money = Instance.new("IntValue")
- Money.Name = "Money"
- Money.Parent = player
- end)
- function dropCash(player, amount)
- if player and amount then
- local newCash = script.MoneyStack:Clone()
- newCash.Amount.Value = amount
- newCash.Handle.BillboardGui.TextLabel.Text = "$"..formatter:Format(amount)
- local dropOffset = 2.5
- local newPos = player.Character.Head.Position + player.Character.Head.CFrame.lookVector*dropOffset
- newCash.Parent = workspace
- newCash.Handle.CFrame = CFrame.new(newPos,newPos+player.Character.Head.CFrame.lookVector)
- newCash.Handle.Velocity = player.Character.Head.CFrame.lookVector*8
- end
- end
- game.ReplicatedStorage.DropCash.OnServerInvoke = function(player, amount)
- print(player, amount)
- if amount then
- if tonumber(amount) then
- amount = tonumber(amount)
- if amount >= 10 then
- if amount <= 25000 then
- if player.Money.Value >= amount then
- if player.Character then
- player.Money.Value -= amount
- dropCash(player, amount)
- return "success"
- end
- else
- return "You don't have this much money!"
- end
- else
- return "You must drop less than $25,000!"
- end
- else
- return "You must drop more than $10!"
- end
- else
- return "Invalid Number!"
- end
- else
- return "Invalid Number!"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement