Guest User

Untitled

a guest
Jun 26th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.73 KB | None | 0 0
  1. --handles medals and king of the hill announcements
  2.  
  3. --handle audio files(Thanks halo multiplayer announcer)
  4. game.ReplicatedStorage.Gamemodeparts["Announcer Voices"].Parent = game.Workspace
  5. game.ReplicatedStorage.Gamemodeparts["VIPmessages"].Parent = game.Workspace
  6.  
  7.  
  8. local Players = game:GetService("Players")
  9. --Lets go through EACH player and add a number value called "Swordkills"
  10. Players.PlayerAdded:Connect(function(player)
  11. for i, v in pairs(game.Players:GetChildren()) do
  12. local doesexist = v:FindFirstChild("Swordkills")
  13. if(doesexist == false or doesexist == nil) then
  14. local test = Instance.new("NumberValue")
  15. test.Parent = v
  16. test.Name = "Swordkills"
  17. test.Value = 0
  18. local test = Instance.new("NumberValue")
  19. test.Parent = v
  20. test.Name = "Hammerkills"
  21. test.Value = 0
  22. end
  23. end
  24. --sometimes if the player kills himself during VIP the owner tag will still be there, this will fix that and add a new vip
  25. player.CharacterAdded:Connect(function(character)
  26. character:WaitForChild("Humanoid").Died:Connect(function()
  27. if(game.ReplicatedStorage.Gamemodeparts.Gamemode.Value == "VIP") then
  28. --hacky fix but if it works it works
  29. wait(8)
  30. if(player:FindFirstChild("Owner")) then
  31. player.Owner:Destroy()
  32. --find a new VIP
  33. game.Workspace.VIPmessages.PlaybackRegionsEnabled = true
  34. game.Workspace.VIPmessages.PlaybackRegion = NumberRange.new(0, 1.730)
  35. game.Workspace.VIPmessages:Play()
  36. --get a random teen
  37. local players = game:GetService("Players"):GetPlayers()
  38. local randomteen = players[math.random(1, #players)]
  39.  
  40. --add the billboard GUI to him
  41. local Killthevip = game.ReplicatedStorage.Gamemodeparts.KilltheVIP:Clone()
  42. Killthevip.Parent = randomteen.Character.Head
  43. --create label to let weapons know this is the VIP onkill
  44. local VIPholder = Instance.new("BoolValue", randomteen.Character)
  45. VIPholder.Name = "VIPholder"
  46. local ownerTag = Instance.new("BoolValue")
  47. ownerTag.Name = "Owner"
  48. ownerTag.Value = true
  49. ownerTag.Parent = randomteen
  50.  
  51. end
  52. end
  53. end)
  54. end)
  55. end)
  56.  
  57. --handle what happens when a player leaves during VIP
  58. Players.PlayerRemoving:Connect(function(playerLeaving)
  59. if(game.ReplicatedStorage.Gamemodeparts.Gamemode.Value == "VIP") then
  60. if(playerLeaving:FindFirstChild("Owner")) then
  61. -- Get valid VIP candidates
  62. local players = Players:GetPlayers()
  63. local potentialVIPs = {}
  64.  
  65. for _, player in ipairs(players) do
  66. local hasCantBeVIP = player:FindFirstChild("CantBeVIP")
  67. or (player.Character and player.Character:FindFirstChild("CantBeVIP"))
  68.  
  69. if not hasCantBeVIP then
  70. table.insert(potentialVIPs, player)
  71. end
  72. end
  73.  
  74. -- Handle case where no valid VIPs exist
  75. if #potentialVIPs == 0 then
  76. warn("[VIP] No valid players for VIP selection.")
  77. return
  78. end
  79.  
  80. -- Pick one at random
  81. local newVIP = potentialVIPs[math.random(1, #potentialVIPs)]
  82.  
  83. -- Setup billboard GUI
  84. local billboard = game.ReplicatedStorage.Gamemodeparts.KilltheVIP:Clone()
  85. billboard.Parent = newVIP.Character:WaitForChild("Head")
  86.  
  87. -- VIP marker for weapons to detect
  88. local vipTag = Instance.new("BoolValue")
  89. vipTag.Name = "VIPholder"
  90. vipTag.Parent = newVIP.Character
  91.  
  92. -- Owner tag for consistency
  93. local ownerTag = Instance.new("BoolValue")
  94. ownerTag.Name = "Owner"
  95. ownerTag.Value = true
  96. ownerTag.Parent = newVIP
  97.  
  98.  
  99.  
  100. end
  101. end
  102. end)
  103.  
  104. local ReplicatedStore = game:GetService("ReplicatedStorage")
  105. local TweenService = game:GetService("TweenService")
  106.  
  107. local touching = workspace:WaitForChild("touching")
  108. local hillVisual = workspace:WaitForChild("hill")
  109. local announce = ReplicatedStore:WaitForChild("SendMessage") -- RemoteEvent
  110.  
  111. local hillOccupants = {}
  112. local debounce = {}
  113.  
  114. -- encode a Color3 to "r,g,b"
  115. local function encodeColor(c)
  116. return string.format("%d,%d,%d", math.floor(c.R*255), math.floor(c.G*255), math.floor(c.B*255))
  117. end
  118.  
  119.  
  120. local function encodeColor2(R, G, B)
  121. return string.format("%d,%d,%d", R, G, B)
  122. end
  123. --Handle when the player dies and reset their killstreaks
  124. game:GetService("Players").PlayerAdded:Connect(function(player)
  125. player.CharacterAdded:Connect(function(character)
  126. character:WaitForChild("Humanoid").Died:Connect(function()
  127. wait(5)
  128. player.Swordkills.Value = 0
  129. player.Hammerkills.Value = 0
  130. end)
  131. end)
  132. end)
  133.  
  134.  
  135. --Handle when the bindable event gets called telling us about a new kill
  136. game.ReplicatedStorage.KillCall.Event:Connect(function(plr, weapon, victim, specialattributes)
  137. local newC = encodeColor2(0, 255, 0)
  138. local NumberKills = plr.Swordkills.value
  139. local victimPlayer = Players:GetPlayerFromCharacter(victim)
  140. print("Doing event")
  141. --handle medals that are not realated to the weapon that was being held like weapon related killstreaks like the killjoy
  142. if(victimPlayer ~= nil) then
  143. print("VictimPlayer".. victimPlayer.Name)
  144.  
  145. print("Instanced")
  146. --Handle instance of a killjoy
  147. if(victimPlayer:FindFirstChild("Swordkills").value > 4 or victimPlayer:FindFirstChild("Hammerkills").value > 4) then
  148. local Killjoycolor = encodeColor2(255, 255, 0)
  149. print("killjoy")
  150. announce:FireAllClients{
  151. Text = " KILLJOY: ".. plr.Name .. " ended ".. victimPlayer.Name "s ".. tostring(victimPlayer.Hammerkills.Value + victimPlayer.Swordkills.value) " Killstreak.",
  152. Metadata = newC
  153. }
  154. else
  155. print("Value for failed killjoy: ".. victimPlayer.Swordkills.value)
  156. end
  157. end
  158. --Handle instance of a survivor
  159. if plr.Character.Humanoid.Health < 31 then
  160. task.spawn(function()
  161. local humanoid = plr.Character:FindFirstChild("Humanoid")
  162. if not humanoid then return end
  163.  
  164. local startTime = tick()
  165.  
  166. while tick() - startTime < 30 do
  167. if humanoid.Health <= 0 then
  168. -- Player died before 30 seconds
  169. return
  170. end
  171. task.wait(1) -- check every second (adjust if needed)
  172. end
  173.  
  174. -- 30 seconds passed, player is still alive
  175. local newC = encodeColor2(0, 255, 0)
  176. announce:FireAllClients{
  177. Text = " SURVIVOR: ".. plr.Name .. " Survived a enouncter with extremely low health and came out on top",
  178. Metadata = newC
  179. }
  180. end)
  181. end
  182. --handle instance of a yoink
  183. if(specialattributes == "Lunging") then
  184. local newC = encodeColor2(255, 255, 0)
  185. announce:FireAllClients{
  186. Text = " Yoink: ".. plr.Name .. "Killed a enemy while they were lunging",
  187. Metadata = newC
  188. }
  189. end
  190. if(weapon == "Sword") then
  191. local newC = encodeColor2(0, 255, 0)
  192. if(NumberKills == 5) then
  193. print("5 KILSTREAK")
  194. announce:FireAllClients{
  195. Text = " >Just waiting for a proper soyduel. ".. plr.Name .. " has gotten 5 kills with the Dual Greentext arrows ",
  196. Metadata = newC
  197. }
  198. else if(NumberKills == 10) then
  199. print("10 KILSTREAK")
  200. announce:FireAllClients{
  201. Text = " >finally a worthy opponent, our battle will be LEGENDARY. ".. plr.Name .. " has gotten 10 kills with the Dual Greentext arrows ",
  202. Metadata = newC
  203. }
  204. end
  205. if(NumberKills == 15) then
  206. print("10 KILSTREAK")
  207. announce:FireAllClients{
  208. Text = " >Make sure to remember the arrow. ".. plr.Name .. " has gotten 15 kills with the Dual Greentext arrows ",
  209. Metadata = newC
  210. }
  211. end
  212. if(NumberKills == 20) then
  213. print("10 KILSTREAK")
  214. announce:FireAllClients{
  215. Text = " >You see that, You say and look like that.".. plr.Name .. " has gotten 20 kills with the Dual Greentext arrows. HES UNSTOPPABLE",
  216. Metadata = newC
  217. }
  218.  
  219. end
  220. end
  221. end
  222. if(weapon == "Hammer") then
  223. local newC = encodeColor2(255, 0, 255)
  224.  
  225. if(NumberKills == 5) then
  226. print("5 KILSTREAK")
  227. announce:FireAllClients{
  228. Text = " STOP... Hammer time".. plr.Name .. " has gotten 5 kills with the Janny Hammer",
  229. Metadata = newC
  230. }
  231. else if(NumberKills == 10) then
  232. print("10 KILSTREAK")
  233. announce:FireAllClients{
  234. Text = " Controlfreak Feared Tryant".. plr.Name .. " has gotten 10 kills with the Janny Hammer ",
  235. Metadata = newC
  236. }
  237. end
  238. if(NumberKills == 15) then
  239. print("10 KILSTREAK")
  240. announce:FireAllClients{
  241. Text = "Banwave...".. plr.Name .. " has gotten 15 kills with the Janny Hammer. ",
  242. Metadata = newC
  243. }
  244. end
  245. if(NumberKills == 20) then
  246. print("10 KILSTREAK")
  247. announce:FireAllClients{
  248. Text = " Jay Irwin ".. plr.Name .. " Is Unfair, Power Hungry, and has a thirst for slaughter." .. plr.Name " IS ON A 20 KILLSTREAK WITH THE JANNY HAMMER" ,
  249. Metadata = newC
  250. }
  251.  
  252. end
  253. end
  254. end
  255. end)
  256.  
  257. --KING OF THE HILL MANAGER
  258. local currentOwner = nil -- tracks who currently owns the hill
  259.  
  260. local function isOnHill(p) return hillOccupants[p] end
  261.  
  262. local function tweenColor(fromColor, toColor, duration)
  263. TweenService:Create(hillVisual,
  264. TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut),
  265. { Color = toColor }
  266. ):Play()
  267. end
  268.  
  269. local function showHillGUI(plr)
  270. local gui = plr:FindFirstChild("PlayerGui")
  271. if not gui then return end
  272.  
  273. local textbox = gui:FindFirstChild("Hill") and gui.Hill:FindFirstChild("TextBox")
  274. if not textbox then return end
  275. local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  276. local goal = { Position = UDim2.new(1, -500, 1, -50) }
  277. TweenService:Create(textbox, tweenInfo, goal):Play()
  278. end
  279.  
  280. local function hideHillGUI(plr)
  281. local gui = plr:FindFirstChild("PlayerGui")
  282. if not gui then return end
  283.  
  284. local textbox = gui:FindFirstChild("Hill") and gui.Hill:FindFirstChild("TextBox")
  285. if not textbox then return end
  286.  
  287. local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  288. local goal = { Position = UDim2.new(1, 6, 1, -50) }
  289. TweenService:Create(textbox, tweenInfo, goal):Play()
  290. end
  291.  
  292. local function HandleHill(hit)
  293. local char = hit.Parent
  294. if not char then return end
  295.  
  296. local hum = char:FindFirstChild("Humanoid")
  297. if not hum then return end
  298.  
  299. local plr = Players:GetPlayerFromCharacter(char)
  300. if not plr or debounce[plr] then return end
  301. debounce[plr] = true
  302. hillOccupants[plr] = true
  303.  
  304. local newColor = plr.TeamColor.Color
  305.  
  306. -- Only change if they don't already own it
  307. if currentOwner ~= plr then
  308. -- Remove Owner tag from previous owner
  309. if currentOwner and currentOwner:FindFirstChild("Owner") then
  310. currentOwner.Owner:Destroy()
  311. hideHillGUI(currentOwner)
  312. end
  313.  
  314. -- Set new owner marker
  315. if not plr:FindFirstChild("Owner") then
  316. local ownerTag = Instance.new("BoolValue")
  317. ownerTag.Name = "Owner"
  318. ownerTag.Value = true
  319. ownerTag.Parent = plr
  320. end
  321.  
  322. showHillGUI(plr)
  323.  
  324. local oldColor = currentOwner and currentOwner.TeamColor.Color or Color3.new(1,1,1)
  325. tweenColor(oldColor, newColor, 3)
  326.  
  327. if currentOwner == nil then
  328. announce:FireAllClients{
  329. Text = plr.Team.Name .. " controls the Hill! 2× cash for them.",
  330. Metadata = encodeColor(newColor)
  331. }
  332. else
  333. announce:FireAllClients{
  334. Text = plr.Name .. " is contesting the hill...",
  335. Metadata = encodeColor(newColor)
  336. }
  337. task.delay(3, function()
  338. if isOnHill(plr) then
  339. currentOwner = plr
  340. touching:SetAttribute("FirstServed", plr.Name)
  341. hillVisual.Color = newColor
  342. announce:FireAllClients{
  343. Text = plr.Team.Name .. " now controls the Hill! 2× cash for them.",
  344. Metadata = encodeColor(newColor)
  345. }
  346. end
  347. end)
  348. return
  349. end
  350.  
  351. currentOwner = plr
  352. touching:SetAttribute("FirstServed", plr.Name)
  353. end
  354.  
  355. task.delay(1, function()
  356. debounce[plr] = nil
  357. end)
  358. end
  359.  
  360. function switchtovip()
  361. -- Make hill inactive
  362. game.Workspace.hill.Transparency = 1
  363. game.Workspace.touching.CanTouch = false
  364.  
  365. -- Play voice line
  366. local messages = game.Workspace.VIPmessages
  367. messages.PlaybackRegionsEnabled = true
  368. messages.PlaybackRegion = NumberRange.new(0, 1.730)
  369. messages:Play()
  370.  
  371. -- Clean up current VIP
  372. if currentOwner then
  373. if currentOwner:FindFirstChild("Owner") then
  374. currentOwner.Owner:Destroy()
  375. end
  376. hideHillGUI(currentOwner)
  377. end
  378.  
  379. -- Get valid VIP candidates
  380. local players = Players:GetPlayers()
  381. local potentialVIPs = {}
  382.  
  383. for _, player in ipairs(players) do
  384. local hasCantBeVIP = player:FindFirstChild("CantBeVIP")
  385. or (player.Character and player.Character:FindFirstChild("CantBeVIP"))
  386.  
  387. if not hasCantBeVIP then
  388. table.insert(potentialVIPs, player)
  389. end
  390. end
  391.  
  392. -- Handle case where no valid VIPs exist
  393. if #potentialVIPs == 0 then
  394. warn("[VIP] No valid players for VIP selection.")
  395. return
  396. end
  397.  
  398. -- Pick one at random
  399. local newVIP = potentialVIPs[math.random(1, #potentialVIPs)]
  400.  
  401. -- Setup billboard GUI
  402. local billboard = game.ReplicatedStorage.Gamemodeparts.KilltheVIP:Clone()
  403. billboard.Parent = newVIP.Character:WaitForChild("Head")
  404.  
  405. -- VIP marker for weapons to detect
  406. local vipTag = Instance.new("BoolValue")
  407. vipTag.Name = "VIPholder"
  408. vipTag.Parent = newVIP.Character
  409.  
  410. -- Owner tag for consistency
  411. local ownerTag = Instance.new("BoolValue")
  412. ownerTag.Name = "Owner"
  413. ownerTag.Value = true
  414. ownerTag.Parent = newVIP
  415.  
  416. end
  417.  
  418. local function cleanUpValues()
  419. for _, player in ipairs(Players:GetPlayers()) do
  420. local ownerValue = player:FindFirstChild("Owner")
  421. if ownerValue then
  422. ownerValue:Destroy()
  423. end
  424.  
  425. if player.Character then
  426. local vipHolder = player.Character:FindFirstChild("VIPholder")
  427. if vipHolder then
  428. vipHolder:Destroy()
  429. end
  430. local Vipbillboard = player.Character.Head:FindFirstChild("KilltheVIP")
  431. if Vipbillboard then
  432. Vipbillboard:Destroy()
  433. end
  434. end
  435. end
  436. end
  437. local Players = game:GetService("Players")
  438. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  439.  
  440. function makesuresoylentexist()
  441. while true do
  442. if ReplicatedStorage.Gamemodeparts.Gamemode.Value ~= "Soylentball" then return end
  443. task.wait(1)
  444.  
  445. local soylents = {} -- List to store all found soylent instances
  446.  
  447. for _, obj in ipairs(workspace:GetChildren()) do
  448. if obj.Name == "Soylent" then
  449. table.insert(soylents, obj)
  450. end
  451. end
  452.  
  453. for _, player in ipairs(Players:GetPlayers()) do
  454. local bpSoylent = player:FindFirstChild("Backpack") and player.Backpack:FindFirstChild("Soylent")
  455. if bpSoylent then
  456. table.insert(soylents, bpSoylent)
  457. end
  458.  
  459. local charSoylent = player.Character and player.Character:FindFirstChild("Soylent")
  460. if charSoylent then
  461. table.insert(soylents, charSoylent)
  462. end
  463. end
  464.  
  465. if #soylents > 1 then
  466. print("[WARN] More than 1 Soylent detected! Count:", #soylents)
  467.  
  468. for i = #soylents, 2, -1 do
  469. local j = math.random(1, i)
  470. soylents[i], soylents[j] = soylents[j], soylents[i]
  471. end
  472.  
  473. for i = 2, #soylents do
  474. if soylents[i] and soylents[i].Parent then
  475. soylents[i]:Destroy()
  476. end
  477. end
  478. elseif #soylents == 0 then
  479. local clone = ReplicatedStorage:FindFirstChild("Soylent")
  480. if clone then
  481. local new = clone:Clone()
  482. new.Parent = workspace
  483.  
  484. if workspace:FindFirstChild("hill") then
  485. workspace.hill.Transparency = 1
  486. end
  487. if workspace:FindFirstChild("touching") then
  488. workspace.touching.CanTouch = false
  489. end
  490. else
  491. warn("Soylent not found in ReplicatedStorage")
  492. end
  493. end
  494. end
  495. end
  496.  
  497. function setupsoylentball()
  498.  
  499. local clone = game.ReplicatedStorage.Soylent:Clone()
  500. clone.Parent = game.Workspace
  501. game.Workspace.hill.Transparency = 1
  502. game.Workspace.touching.CanTouch = false
  503. end
  504. game.ReplicatedStorage.Gamemodeparts.Vipchange.Event:Connect(function(Player, Player2)
  505. Player2.Character.Head.KilltheVIP:Destroy()
  506. Player2.Owner:Destroy()
  507.  
  508.  
  509. game.Workspace.VIPmessages.PlaybackRegionsEnabled = true
  510. game.Workspace.VIPmessages.PlaybackRegion = NumberRange.new(1.730, 3.683)
  511. game.Workspace.VIPmessages:Play()
  512. local VIPholder = Instance.new("BoolValue", Player.Character)
  513. VIPholder.Name = "VIPholder"
  514. local ownerTag = Instance.new("BoolValue")
  515. ownerTag.Name = "Owner"
  516. ownerTag.Value = true
  517. ownerTag.Parent = Player
  518. local Killthevip = game.ReplicatedStorage.Gamemodeparts.KilltheVIP:Clone()
  519. Killthevip.Parent = Player.Character.Head
  520. end)
  521. touching.Touched:Connect(function(hit)
  522. local char = hit.Parent
  523. local plr = Players:GetPlayerFromCharacter(char)
  524. if plr then
  525. HandleHill(hit)
  526. end
  527. end)
  528.  
  529. wait(18)
  530. --start message on start of server
  531. announce:FireAllClients{
  532. Text = "Welcome. Current Gamemode rotation is King of the hill VIP, and Soylentball",
  533. Metadata = encodeColor(Color3.new(1, 0, 0))
  534. }
  535.  
  536. while true do
  537. if(game.ReplicatedStorage.Settings["Gamemode settings"].IncludeKingoftheHillinrotation.Value == true ) then
  538. cleanUpValues()
  539. game.ReplicatedStorage.Gamemodeparts.Gamemode.Value = "King of the hill"
  540. game.Workspace.hill.Transparency = 0
  541. game.Workspace.touching.CanTouch = true
  542. task.wait(60)
  543. announce:FireAllClients{
  544. Text = "4 Mintues Remaing on King of the Hill",
  545. Metadata = encodeColor(Color3.new(1, 0, 0))
  546. }
  547. task.wait(120)
  548. announce:FireAllClients{
  549. Text = "Gamemode will switch to VIP in two minutes",
  550. Metadata = encodeColor(Color3.new(1, 0, 0))
  551. }
  552. task.wait(120)
  553. announce:FireAllClients{
  554. Text = "King of the Hill is over, Its VIP time.",
  555. Metadata = encodeColor(Color3.new(1, 0, 0))
  556. }
  557. end
  558. if(game.ReplicatedStorage.Settings["Gamemode settings"].IncludeVIPinrotation.Value == true ) then
  559. game.ReplicatedStorage.Gamemodeparts.Gamemode.Value = "VIP"
  560.  
  561. switchtovip()
  562. task.wait(60)
  563. announce:FireAllClients{
  564. Text = "VIP is ending in 4 minutes.",
  565. Metadata = encodeColor(Color3.new(1, 0, 0))
  566. }
  567. task.wait(120)
  568. announce:FireAllClients{
  569. Text = "VIP is almost over, Soylent Ball will be chosen for the next gamemode in two minutes.",
  570. Metadata = encodeColor(Color3.new(1, 0, 0))
  571. }
  572. task.wait(120)
  573. announce:FireAllClients{
  574. Text = "VIP is over, Soylent Ball is the new gamemode.",
  575. Metadata = encodeColor(Color3.new(1, 0, 0))
  576. }
  577. cleanUpValues()
  578.  
  579. end
  580. if(game.ReplicatedStorage.Settings["Gamemode settings"].IncludeSoylentballinrotation.Value == true) then
  581. game.ReplicatedStorage.Gamemodeparts.Gamemode.Value = "Soylentball"
  582.  
  583. task.delay(0, makesuresoylentexist())
  584. setupsoylentball()
  585. task.wait(60)
  586. announce:FireAllClients{
  587. Text = "Soylent Ball is almost over, King of the Hill will be chosen for the next gamemode in 4 minutes.",
  588. Metadata = encodeColor(Color3.new(1, 0, 0))
  589. }
  590. task.wait(120)
  591. announce:FireAllClients{
  592. Text = "Soylent Ball is ending in 2 minutes.",
  593. Metadata = encodeColor(Color3.new(1, 0, 0))
  594. }
  595. task.wait(120)
  596. announce:FireAllClients{
  597. Text = "Soylent Ball is over, King of the hill is the new gamemode.",
  598. Metadata = encodeColor(Color3.new(1, 0, 0))
  599. }
  600. game.workspace["Announcer Voices"]:Play()
  601. end
  602. end
Advertisement
Add Comment
Please, Sign In to add comment