Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- INITIALIZATION
- local spawnTimer = 10 -- in seconds
- local maxAmt = 99
- -- local chatColor = Color3.new(1, 1, 0.1)
- local chatColor = Color3.new(1, 1, 1)
- local specialText = {
- [“Farticuno”] = {“PLAYER has obtained Farticuno… WHAT???”, “A cold one… with the boys!?”}
- }
- -- Data structure of specialText (a dictionary):
- -- keys are pokemon names, values are an array containing
- -- 1: server message (PLAYER=player’s name) and 2: client message
- -- When a
- local SSServ = game:GetService("ServerScriptService")
- local Stats = require(SSServ:WaitForChild(“Stats”))
- local Toucher = require(SSServ:WaitForChild("Libraries"):WaitForChild("OnTouched"))
- local chatEvent = game.ReplicatedStorage:FindFirstChild(“ChatEvent”)
- local foo = task
- local amt = 0
- -- FUNCTIONS
- local function sendNotification(plr, text, t)
- if chatEvent then
- chatEvent:FireClient(plr, “NaroZinC: ”, text, chatColor, chatColor, “”, t, “”)
- end
- end
- local function generateMon() -- mon chances
- -- lazy to type it
- -- should return a string of the mon name
- end
- local function findSpawn(mon)
- local spawnDict = script[mon]:GetChildren()
- while true do
- local possible = spawnDict[math.random(1, #spawnDict)]
- if possible.Name ~= “T” then return possible end -- probably breaks the loop :thumbs_up:
- end
- end
- local function rewardMon(plr, mon)
- Stats.SetStat(plr, mon, 1)
- local selfText = “You got “..mon..”!”
- local servText = “GOTCHA! “..plr..” found the roaming “..mon..”!”
- if specialText[mon] then
- selfText = specialText[mon][2]
- servText = specialText[mon][1]
- local pIndex = 1
- while pIndex<=string.len(servText)-5 and string.sub(servText, pIndex, pIndex+5) ~= “PLAYER” do pIndex += 1 end
- if pIndex <= string.len(servText)-5 then
- servText = string.sub(servText, 1, pIndex-1)..plr..string.sub(servText, pIndex+1)
- end
- end
- sendNotification(p, selfText, true)
- for i, p in pairs(game.Players:GetChildren()) do sendNotification(p, servText, false) end
- end
- -- MAIN METHOD
- local function doStuff()
- while true do
- foo.wait(spawnTimer)
- if amt < maxAmt then
- amt += 1
- local monName = generateMon()
- local myBlock = findSpawn(myMon)
- local myMon = script.RModels:FindFirstChild(monName):Clone()
- myBlock.Name = "T" -- shows this spawn is taken
- myMon:SetPrimaryPartCFrame(myBlock.CFrame)
- myMon.Parent = workspace
- for i, p in pairs(game.Players:GetChildren()) do SendNotificaiton(p, “A wild “..monName..” appeared! DUNUNUNUnunununu bam bam bam bababam bum bam bam bam bababam”, false) end
- local debounce = false
- Toucher.Touched(myMon.PrimaryPart, function(hit)
- if not debounce and thend”) then
- local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
- debounce = true
- if Stats.GetStat(plr, monName) == 0 then
- rewardMon(plr, monName)
- myMon:Destroy()
- debounce = false
- myBlock.Name = “E” -- shows this spawn is empty
- end
- end)
- end
- end
- end
- return doStuff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement