Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Local Script
- local guiItems = script.Parent:GetChildren()
- local player = game.Players.LocalPlayer
- workspace["NPC man"].ClickDetector.MouseClick:Connect(function()
- script.Parent.Visible = true
- end)
- for _, thing in pairs(guiItems)do
- if thing:IsA("TextButton")then
- thing.Activated:Connect(function()
- game.ReplicatedStorage.UpdateLeaderboards:FireServer(thing.Cost.Value, thing)
- script.Parent.Visible = false
- end)
- end
- end
- -- Server script
- local isRunning = false
- game.ReplicatedStorage.UpdateLeaderboards.OnServerEvent:Connect(function(player, value, thing)
- if isRunning == false then
- isRunning = true
- player.leaderstats["Monett $_$"].Value -= value
- local clone = game.ServerStorage[thing.Name]:Clone()
- clone.Parent = workspace.Part
- clone.Position = workspace.Part.Position + Vector3.new(0, 5, 0)
- wait(1)
- isRunning = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement