Advertisement
Existence_YT

[RobloxStudioProjects] EmergencyCallSys - CDB_Server

Nov 29th, 2019
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. local sendCall = game.ReplicatedStorage.Remotes.sendCall
  2. local acceptCall = game.ReplicatedStorage.Remotes.acceptCall
  3.  
  4. local count = 0
  5. function createCall(parent, txt)
  6.     local CallTxt = Instance.new("TextLabel")
  7.     local AcceptBtn = Instance.new("TextButton")
  8.     CallTxt.Name = "Call"..tostring(count)
  9.     CallTxt.Parent = parent
  10.     CallTxt.Active = true
  11.     CallTxt.BackgroundColor3 = Color3.new(0, 0.666667, 1)
  12.     CallTxt.BorderSizePixel = 0
  13.     CallTxt.Position = UDim2.new(1.70679968e-08, 0, 0, 0)
  14.     CallTxt.Size = UDim2.new(0.699999988, 0, 0.00200000009, 0)
  15.     CallTxt.Font = Enum.Font.SourceSansBold
  16.     CallTxt.Text = tostring(txt)
  17.     CallTxt.TextColor3 = Color3.new(1, 1, 1)
  18.     CallTxt.TextSize = 14
  19.     AcceptBtn.Name = "Accept"
  20.     AcceptBtn.Parent = CallTxt
  21.     AcceptBtn.BackgroundColor3 = Color3.new(0, 0.666667, 0)
  22.     AcceptBtn.BorderSizePixel = 0
  23.     AcceptBtn.Position = UDim2.new(0.997123718, 0, 0, 0)
  24.     AcceptBtn.Size = UDim2.new(0.412272304, 0, 0.999999464, 0)
  25.     AcceptBtn.AutoButtonColor = false
  26.     AcceptBtn.Font = Enum.Font.SourceSansBold
  27.     AcceptBtn.Text = "Accept"
  28.     AcceptBtn.TextColor3 = Color3.new(1, 1, 1)
  29.     AcceptBtn.TextSize = 14
  30.     AcceptBtn.MouseButton1Click:Connect(function()
  31.         for i, v in pairs(game.Players:GetChildren()) do
  32.             if v.Team.Name == "Police" then
  33.                 if AcceptBtn.Text ~= "Accepted" then
  34.                     acceptCall:FireClient(v, "Call"..tostring(string.sub(AcceptBtn.Parent.Name, 5)))
  35.                     v.PlayerGui.CallDatabase.MainFrame.CallHolder["Call"..tostring(string.sub(AcceptBtn.Parent.Name, 5))].Accept.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  36.                     v.PlayerGui.CallDatabase.MainFrame.CallHolder["Call"..tostring(string.sub(AcceptBtn.Parent.Name, 5))].Accept.Text = "Accepted"
  37.                 end
  38.             end
  39.         end
  40.     end)
  41.     count = count + 1
  42. end
  43.  
  44. sendCall.OnServerEvent:Connect(function(plr, call)
  45.     for i, v in pairs(game.Players:GetChildren()) do
  46.         if v.Team.Name == "Police" then
  47.             createCall(v.PlayerGui.CallDatabase.MainFrame.CallHolder, call)
  48.         end
  49.     end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement