Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Services
- PlayerService = game:GetService('Players')
- TweenService = game:GetService('TweenService')
- TeleportService = game:GetService("TeleportService")
- -- Variables
- DefaultMessageDelayTime = 4
- LetterInvertal = 0.05
- MessageWaitSigns = {',', '?', '.'}
- MessageWaitSignDelay = 1
- local NightStatus = game.ReplicatedStorage.NightStatus
- local ObjectiveValue = game.ReplicatedStorage.Objective
- local Status = game.ReplicatedStorage.Status
- local MessageValue = game.ReplicatedStorage.Message
- local ImageValue = game.ReplicatedStorage.Message.SpeakerImage
- local SpeakerNameValue = game.ReplicatedStorage.Message.SpeakerName
- local Cutscene1 = game.ReplicatedStorage.CutscenesEvent.Cutscene
- local TeleportPoints = game.Workspace.TeleportPoints
- local TransitionEvent = game.ReplicatedStorage.TransitionEvent
- -- Setup Player Images
- local RandomPlayer
- PlayerImages = {}
- function MakePlayerImage(Player)
- local Image = ''
- local Success,Error = pcall(function()
- local ID = PlayerService:GetUserIdFromNameAsync(Player.Name)or ''
- local PlayerImage, IsReady = PlayerService:GetUserThumbnailAsync(ID, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
- if IsReady == true then
- -- Ready to use image
- Image = tostring(PlayerImage)
- else
- -- Use alternative picture
- Image = ("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=%s"):format(Player.Name)
- end
- end)
- if Success == true then
- -- Successful
- else
- Image = ("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=%s"):format(Player.Name)
- end
- PlayerImages[Player.Name] = Image
- end
- game.Players.PlayerAdded:Connect(function(Player)
- MakePlayerImage(Player)
- end)
- for _, Player in pairs(game.Players:GetChildren()) do
- MakePlayerImage(Player) -- This is cause dosent rly activate PlayerAdded event on play testing
- end
- -- Functions
- function BroadcastMessage(Text, MessageDelayTime)
- -- This makes the message appear like a typewriter
- for i = 1,#Text,1 do
- MessageValue.Value = string.sub(Text,1,i)
- for _, L in pairs(MessageWaitSigns) do
- if string.sub(Text,i,i) == L then
- wait(MessageWaitSignDelay)
- end
- end
- wait(LetterInvertal)
- end
- if tonumber(MessageDelayTime) ~= nil then
- wait(MessageDelayTime)
- else
- wait(DefaultMessageDelayTime)
- end
- MessageValue.Value = 'None'
- return true
- end
- function SetMessageSpeaker(Name)
- if Name == "Random" then
- RandomPlayer = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
- Name = RandomPlayer.Name
- end
- ImageValue.Value = PlayerImages[Name] or 'rbxassetid://12325724267'
- SpeakerNameValue.Value = Name
- end
- function SetMessageSpeaker2(Name)
- ImageValue.Value = 'rbxassetid://12328732473'
- SpeakerNameValue.Value = Name
- end
- function ChangeTime(ToTime, TweenDuration)
- local Lightning = game.Lighting
- local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
- local Tween = TweenService:Create(Lightning, TI, {ClockTime = ToTime})
- Tween:Play()
- end
- function ChangeFogend(ChangeTo, TweenDuration,ColourOrNone)
- if ColourOrNone ~= 'None' then
- game.Lighting.FogColor = ColourOrNone
- end
- local FogendValue = Instance.new('IntValue')
- FogendValue.Value = game.Lighting.FogEnd
- FogendValue:GetPropertyChangedSignal('Value'):Connect(function()
- game.Lighting.FogEnd = FogendValue.Value
- end)
- local TI = TweenInfo.new(TweenDuration,Enum.EasingStyle.Linear)
- local Tween = TweenService:Create(FogendValue, TI, {Value = ChangeTo})
- Tween:Play()
- spawn(function()
- Tween.Completed:Connect(function()
- FogendValue:Destroy()
- end)
- end)
- end
- function teleportPlayers(partCFrame)
- local players = game.Players:getPlayers()
- for _,player in pairs(players) do
- if player.Character then
- if player.Character.HumanoidRootPart.Anchored == false then
- player.Character.Humanoid.Jump = true
- end
- end
- end
- wait(.5)
- for _,player in pairs(players) do
- if player.Character then
- if player.Character.HumanoidRootPart.Anchored == false then
- player.Character:SetPrimaryPartCFrame(partCFrame)
- end
- end
- end
- end
- function TopStatus(number)
- for i = number, 0, -1 do
- Status.Value = "Waiting For Players("..i..")"
- wait(1)
- end
- Status.Value = "None"
- end
- function SetObjective(Text)
- ObjectiveValue.Value = Text
- end
- function ClearObjective()
- ObjectiveValue.Value = "None"
- end
- function ChapterComplete()
- for _, player in pairs(game.Players:GetPlayers()) do
- spawn(function()
- local NewGui = game.ServerStorage:WaitForChild("Assets"):FindFirstChild("ChapterComplete"):Clone()
- NewGui.Parent = player.PlayerGui
- wait(5)
- local TeleportData = {
- AddWins = true,
- PlayerName = player.UserId
- }
- player.Coins.Value = player.Coins.Value + 100
- player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1
- TeleportService:Teleport(11258969850, player, TeleportData)
- end)
- end
- end
- function AddCoins(AddCoin)
- for i, v in pairs(game.Players:GetPlayers()) do
- spawn(function()
- v.Coins.Value += AddCoin
- end)
- end
- end
- -- MainScript --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement