Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chatservice = game:GetService("Chat")
- local replicatedstorage = game:GetService("ReplicatedStorage")
- local callevent = replicatedstorage:WaitForChild("CallEvent")
- local twitterevent = replicatedstorage:WaitForChild("TwitterEvent")
- local callfunctions = {}
- callevent.OnServerEvent:Connect(function(player, target, type_)
- if type_ == "Start" then
- local player_ = game.Players:FindFirstChild(target)
- if not player_ then return end
- callevent:FireClient(player_, player.Name, "Incoming")
- elseif type_ == "Decline" then
- local player_ = game.Players:FindFirstChild(target)
- callevent:FireClient(player_, player.Name, "Decline")
- elseif type_ == "Accept" then
- local player_ = game.Players:FindFirstChild(target)
- if callfunctions[player] then callfunctions[player]:Disconnect() end
- if callfunctions[player_] then callfunctions[player_]:Disconnect() end
- callfunctions[player] = player.Chatted:Connect(function(message)
- local phone = player_.Character:FindFirstChild("iphonex")
- if phone then
- chatservice:Chat(phone.Handle, message, Enum.ChatColor.Red)
- end
- end)
- callfunctions[player_] = player_.Chatted:Connect(function(message)
- local phone = player.Character:FindFirstChild("iphonex")
- if phone then
- chatservice:Chat(phone.Handle, message, Enum.ChatColor.Red)
- end
- end)
- callevent:FireClient(player_, player.Name, "Accept")
- elseif type_ == "End" then
- local player_ = game.Players:FindFirstChild(target)
- if callfunctions[player] then
- callfunctions[player]:Disconnect()
- end
- if callfunctions[player_] then
- callfunctions[player_]:Disconnect()
- end
- callevent:FireClient(player_, player.Name, "End")
- end
- end)
- twitterevent.OnServerEvent:Connect(function(player, message)
- twitterevent:FireAllClients(player.Name..": "..message)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement