-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathgamblingscambot.lua
More file actions
96 lines (88 loc) · 3.9 KB
/
Copy pathgamblingscambot.lua
File metadata and controls
96 lines (88 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
local waitingpayment = false
local waitingpaymentuser = ""
local waitingpaymentamount = 0
function Split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
function say(message)
local args = {
[1] = message,
[2] = "All"
}
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(unpack(args))
end
function PlayerAdded(plr)
plr.Chatted:Connect(function(msg)
if string.find(msg, "!coinflip ") and waitingpayment == false then
print("Coinflip in bound", tostring(Split(msg, "!coinflip ")[2]), plr.Name)
waitingpaymentuser = plr.Name
waitingpaymentamount = tonumber(Split(msg, "!coinflip ")[2])
waitingpayment = true
say("/ad " .. plr.Name .. " wagered " .. tostring(waitingpaymentamount) .. "! Awaiting transaction . . .")
end
end)
end
game.Players.PlayerAdded:Connect(PlayerAdded) -- connect each time someone joins
for i,v in pairs(game.Players:GetPlayers()) do --players that were already in game
PlayerAdded(v)
end
local lastmoney
local numcount = 0
local normalcount = 0
spawn(function()
while true do
wait(0.1)
if waitingpayment then
numcount = numcount + 1
local money = game.Players.LocalPlayer.PlayerData.Currency.Value
if numcount == 250 then
say(waitingpaymentuser .. " waited too long. Play by using '!coinflip <amount>'")
waitingpayment = false
numcount = 0
end
if numcount == 50 then
say("/ad Press T > Give money to player > [Amount: " .. tostring(waitingpaymentamount) .. ", Player Name: " .. game.Players.LocalPlayer.Name .. "]")
end
if money >= lastmoney + waitingpaymentamount then
print("payment received", tostring(waitingpaymentamount), waitingpaymentuser)
waitingpayment = false
if waitingpaymentamount > 1500 then
if math.random(1, 1000) > 700 then
local args = {
[1] = 2,
[2] = tostring(waitingpaymentamount * 2),
[3] = waitingpaymentuser
}
game:GetService("ReplicatedStorage").Events.MenuActionEvent:FireServer(unpack(args))
say("/ad " .. waitingpaymentuser .. " has won $" .. tostring(waitingpaymentamount) .. "! To play yourself, type !coinflip <amount>")
else
say("/ad " .. waitingpaymentuser .. " has lost. To play yourself, type !coinflip <amount>")
end
elseif waitingpaymentamount < 1500 then
if math.random(1, 1000) > 500 then
local args = {
[1] = 2,
[2] = tostring(waitingpaymentamount * 2),
[3] = waitingpaymentuser
}
game:GetService("ReplicatedStorage").Events.MenuActionEvent:FireServer(unpack(args))
say("/ad " .. waitingpaymentuser .. " has won $" .. tostring(waitingpaymentamount) .. "! To play yourself, type !coinflip <amount>")
else
say("/ad " .. waitingpaymentuser .. " has lost. To play yourself, type !coinflip <amount>")
end
end
end
else
normalcount = normalcount + 1
if normalcount == 600 then
say("/ad Hello! To play type '!coinflip <amount>'!")
normalcount = 0
end
lastmoney = game.Players.LocalPlayer.PlayerData.Currency.Value
end
end
end)