| |
|
»
»
|
|
| |
Re: Script not working correctly, help.
|
|
|
|
| 15 Aug 2017 04:46 PM |
Sorry that I don't use loops, I'm kinda new to this stuff. Whenever I run the code below, it always skips the part that I specified below with the triple stars. Can anyone figure out why?
-- In a LocalScript in StarterGui: local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent
local textLabel = Instance.new("TextLabel") textLabel.Font = "Code" textLabel.TextColor3 = Co###############5####5####textLabel.TextStrokeTransparency = 0 textLabel.TextStrokeColor3 = Color3.new("Black") textLabel.TextWrapped = true textLabel.TextScaled = true textLabel.Parent = screenGui textLabel.Position = UDim2.new(0, 1, 0, -35) textLabel.Size = UDim2.new(0, 1359, 0, 100) textLabel.BackgroundTransparency = 1 textLabel.Text = "You need 4 players to play a game." function teleportPlayers(ifEnoughPlayers) while #game.Players:GetPlayers() < 4 do wait() end end teleportPlayers()
... unrelevant script stuff, mostly words on screen and such ...
target = CFrame.new(7, 0.5, -30) --could be near a brick or in a new area for i, player in ipairs(game.Players:GetChildren()) do --Make sure the character exists and its HumanoidRootPart exists if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then --add an offset of 5 for each character player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0) end end local players = game.Players:GetPlayers()
local playerNumber = game.Players.NumPlayers textLabel.Text = "Every player now needs to choose a seat." *** while wait(1) do
for i, p in pairs(players) do if p.Character then local humanoid = p.Character:FindFirstChild("Humanoid") if humanoid.Sit == true then --chair script fired textLabel.Text = "All players are now seated." wait (3) textLabel.Text = "Let us begin the game!" wait(3) textLabel.Text = "Welcome to Roblox Mafia!" game.Workspace.SoundBlock1.Tada:Play() wait(3) textLabel.Text = "A game dedicated to Alex and Ruben." wait(3) textLabel.Text = "The game is very simple." wait(3) textLabel.Text = "The game randomly chooses three people to be either a Murderer, Doctor, or Detective." wait(5) textLabel.Text = "The murderer can kill one person secretly, the doctor can save the person who got murdered if they guess who the murderer killed. The detective however, can accuse someone and the game will return a yes, or no. Depending on if they guessed correctly." wait(16) textLabel.Text = "Choosing the murderer." wait(.5) textLabel.Text = "Choosing the murderer.." wait(.5) textLabel.Text = "Choosing the murderer..." wait(.5) textLabel.Text = "Choosing the murderer." wait(.5) textLabel.Text = "Choosing the murderer.." wait(.5) textLabel.Text = "Choosing the murderer..." if #players >= 4 then local murderer = players[math.random(1, #players)] print(murderer) local sg = Instance.new("ScreenGui") sg.Parent = murderer local Mf###### Instance.new("Frame") Mf############# sg Mf############### Vector3.new(0, 400, 0, 300) Mf########### Vector3.new(0, 400, 0, 400) Mf############ "Roblox Round" local murdererText = Instance.new("TextLabel") murdererText.Parent = Mframe murdererText.Position = Vector3.new(0, 0, 0, 0) murdererText.Size = Vector3.new(0, 400, 0, 400) murdererText.BackgroundTransparency = 1 murdererText.Font = "Code" murdererText.TextScaled = true murdererText.TextWrapped = true murdererText.TextStrokeTransparency = 0 murdererText.TextStrokeColor3 = Color3.new(255, 0, 0) murdererText.TextColor3 = Color3.new(255, 0, 0) murdererText.Text = "You're the murderer. Kill everyone until two people are left." end end wait(1) *** textLabel.Text = "The murderer has been chosen." game.Workspace.SoundBlock1.Murderersound:Play() wait(5) ... (more code down here, I just took it away cause it isn't relevant...) ... |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2017 04:51 PM |
Sorry that I don't use loops, I'm kinda new to this stuff. Whenever I run the code below, it always skips the part that I specified below with the triple stars. Can anyone figure out why?
-- In a LocalScript in StarterGui: local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent
local textLabel = Instance.new("TextLabel") textLabel.Font = "Code" textLabel.Te xt Col o r3 = Co lor3 .new( some color here don't worry, I have that.) textLabel.TextStrokeTransparency = 0 textLabel.TextStrokeColor3 = Color3.new("Black") textLabel.TextWrapped = true textLabel.TextScaled = true textLabel.Parent = screenGui textLabel.Position = UDim2.new(0, 1, 0, -35) textLabel.Size = UDim2.new(0, 1359, 0, 100) textLabel.BackgroundTransparency = 1 textLabel.Text = "You need 4 players to play a game." function teleportPlayers(ifEnoughPlayers) while #game.Players:GetPlayers() < 4 do wait() end end teleportPlayers()
... unrelevant script stuff, mostly words on screen and such ...
target = CFrame.new(7, 0.5, -30) --could be near a brick or in a new area for i, player in ipairs(game.Players:GetChildren()) do --Make sure the character exists and its HumanoidRootPart exists if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then --add an offset of 5 for each character player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0) end end local players = game.Players:GetPlayers()
local playerNumber = game.Players.NumPlayers textLabel.Text = "Every player now needs to choose a seat." *** while wait(1) do
for i, p in pairs(players) do if p.Character then local humanoid = p.Character:FindFirstChild("Humanoid") if humanoid.Sit == true then --chair script fired textLabel.Text = "All players are now seated." wait (3) textLabel.Text = "Let us begin the game!" wait(3) textLabel.Text = "Welcome to Roblox Mafia!" game.Workspace.SoundBlock1.Tada:Play() wait(3) textLabel.Text = "A game dedicated to Alex and Ruben." wait(3) textLabel.Text = "The game is very simple." wait(3) textLabel.Text = "The game randomly chooses three people to be either a Murderer, Doctor, or Detective." wait(5) textLabel.Text = "The murderer can kill one person secretly, the doctor can save the person who got murdered if they guess who the murderer killed. The detective however, can accuse someone and the game will return a yes, or no. Depending on if they guessed correctly." wait(16) textLabel.Text = "Choosing the murderer." wait(.5) textLabel.Text = "Choosing the murderer.." wait(.5) textLabel.Text = "Choosing the murderer..." wait(.5) textLabel.Text = "Choosing the murderer." wait(.5) textLabel.Text = "Choosing the murderer.." wait(.5) textLabel.Text = "Choosing the murderer..." if #players >= 4 then local murderer = players[math.random(1, #players)] print(murderer) local sg = Instance.new("ScreenGui") sg.Parent = murderer local M f rame = Instance.new("Frame") M f rame.Parent = sg M f rame.Position = Vector3.new(0, 400, 0, 300) M # #a######### Vector3.new(0, 400, 0, 400) M # #a########## "Roblox Round" local murdererText = Instance.new("TextLabel") murdererText.Parent = Mframe murdererText.Position = Vector3.new(0, 0, 0, 0) murdererText.Size = Vector3.new(0, 400, 0, 400) murdererText.BackgroundTransparency = 1 murdererText.Font = "Code" murdererText.TextScaled = true murdererText.TextWrapped = true murdererText.TextStrokeTransparency = 0 murdererText.TextStrokeColor3 = Color3.new(255, 0, 0) murdererText.TextColor3 = Color3.new(255, 0, 0) murdererText.Text = "You're the murderer. Kill everyone until two people are left." end end wait(1) *** textLabel.Text = "The murderer has been chosen." game.Workspace.SoundBlock1.Murderersound:Play() wait(5) ... (more code down here, I just took it away cause it isn't relevant...) ...
USE THIS VERSION IF THE OTHER ONE CONFUSED YOU, THIS ONE HAS NO HASHTAGS. |
|
|
| Report Abuse |
|
|
|
| |
|
|
| |
|
»
»
|
|
|
|
|