Advertisement
3DCreator

Replacement script

Feb 12th, 2024
1,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local chatservice = game:GetService("Chat")
  2. local replicatedstorage = game:GetService("ReplicatedStorage")
  3. local callevent = replicatedstorage:WaitForChild("CallEvent")
  4. local twitterevent = replicatedstorage:WaitForChild("TwitterEvent")
  5. local callfunctions = {}
  6.  
  7. callevent.OnServerEvent:Connect(function(player, target, type_)
  8.     if type_ == "Start" then
  9.         local player_ = game.Players:FindFirstChild(target)
  10.         if not player_ then return end
  11.          callevent:FireClient(player_, player.Name, "Incoming")
  12.     elseif type_ == "Decline" then
  13.         local player_ = game.Players:FindFirstChild(target)
  14.         callevent:FireClient(player_, player.Name, "Decline")
  15.     elseif type_ == "Accept" then
  16.         local player_ = game.Players:FindFirstChild(target)
  17.         if callfunctions[player] then callfunctions[player]:Disconnect() end
  18.         if callfunctions[player_] then callfunctions[player_]:Disconnect() end
  19.         callfunctions[player] = player.Chatted:Connect(function(message)
  20.             local phone = player_.Character:FindFirstChild("iphonex")
  21.             if phone then
  22.                 chatservice:Chat(phone.Handle, message, Enum.ChatColor.Red)
  23.             end
  24.         end)
  25.        
  26.         callfunctions[player_] = player_.Chatted:Connect(function(message)
  27.             local phone = player.Character:FindFirstChild("iphonex")
  28.             if phone then
  29.                 chatservice:Chat(phone.Handle, message, Enum.ChatColor.Red)
  30.             end
  31.         end)
  32.         callevent:FireClient(player_, player.Name, "Accept")
  33.     elseif type_ == "End" then
  34.         local player_ = game.Players:FindFirstChild(target)
  35.         if callfunctions[player] then
  36.             callfunctions[player]:Disconnect()
  37.         end
  38.         if callfunctions[player_] then
  39.             callfunctions[player_]:Disconnect()
  40.         end
  41.         callevent:FireClient(player_, player.Name, "End")
  42.     end
  43. end)
  44.  
  45. twitterevent.OnServerEvent:Connect(function(player, message)
  46.     twitterevent:FireAllClients(player.Name..": "..message)
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement