Argument 1 missing or nil on my story game code from Ponchokings ?
I've tried redoing it in a new baseplate but that does not work, the first time I did this it worked but I accidentally deleted the gameScript now it gives Argument 1 missing or nil
1 | 17 : 16 : 52.756 Argument 1 missing or nil - Server - gameScript: 10 |
2 | 17 : 16 : 52.756 Stack Begin - Studio |
3 | 17 : 16 : 52.756 Script 'ServerScriptService.gameScript' , Line 10 - function getPlayerImage - Studio - gameScript: 10 |
4 | 17 : 16 : 52.756 Script 'ServerScriptService.gameScript' , Line 78 - function challenge_ 1 - Studio - gameScript: 78 |
5 | 17 : 16 : 52.756 Script 'ServerScriptService.gameScript' , Line 128 - function startGame - Studio - gameScript: 128 |
6 | 17 : 16 : 52.756 Script 'ServerScriptService.gameScript' , Line 136 - Studio - gameScript: 136 |
7 | 17 : 16 : 52.756 Stack End - Studio |
this is the code that break it
04 | local function getPlayerImage(player_id) |
05 | local content, isReady = game:GetService( "Players" ):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size 420 x 420 ) |
09 | local function getRandomPlayer() |
10 | local players = game.Players:getPlayers() |
11 | local number = math.random( 1 ,#players) |
12 | local randomPlayer = players [ number ] |
13 | randomPlayerName = randomPlayer.Name |
14 | randomPlayerId = randomPlayer.UserId |
idk why it broke it worked the first time but broke at the second time I copied this from
Ponchokings Video
The link he gave
my CreateDialogueEvent:
01 | local player = game.Players.LocalPlayer |
02 | local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent |
03 | local DialogueFrame = player.PlayerGui.ScreenGui.Frame |
05 | local function playSound(sound_id) |
06 | local sound = Instance.new( "Sound" ,game.ReplicatedStorage) |
07 | sound.SoundId = sound_id |
09 | sound.PlayOnRemove = true |
13 | local function textAnimate(content) |
14 | for i = 1 ,string.len(content) do |
15 | DialogueFrame.TextLabel.Text = string.sub(content, 1 ,i) |
17 | if string.sub(content,i,i) = = "!" or string.sub(content,i,i) = = "." or string.sub(content,i,i) = = "?" then |
19 | elseif string.sub(content,i,i) = = "," then |
27 | CreateDialogueEvent.OnClientEvent:Connect( function (image_id, content) |
28 | if not player:findFirstChild( "secretEnding" ) then |
29 | DialogueFrame.ImageLabel.Image = image_id |
30 | DialogueFrame.TextLabel.Text = "" |
31 | DialogueFrame.Visible = true |
Ponchokings code
my gameScript code
001 | local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent |
002 | local TimerEvent = game.ReplicatedStorage.TimerEvent |
006 | local randomPlayerName |
009 | local function getPlayerImage(player_id) |
010 | local content, isReady = game:GetService( "Players" ):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size 420 x 420 ) |
014 | local function getRandomPlayer() |
015 | local players = game.Players:getPlayers() |
016 | local number = math.random( 1 ,#players) |
017 | local randomPlayer = players [ number ] |
018 | randomPlayerName = randomPlayer.Name |
019 | randomPlayerId = randomPlayer.UserId |
026 | local npc = game.Workspace.Teacher |
028 | local point 1 = game.Workspace.Checkpoint 1 |
029 | local point 2 = game.Workspace.Checkpoint 2 |
030 | local point 3 = game.Workspace.Checkpoint 3 |
031 | local point 4 = game.Workspace.Checkpoint 4 |
032 | local point 5 = game.Workspace.Checkpoint 5 |
033 | local point 6 = game.Workspace.Checkpoint 6 |
034 | local point 7 = game.Workspace.Checkpoint 7 |
036 | npc.Humanoid:MoveTo(point 1. Position) |
037 | npc.Humanoid:MoveTo(point 2. Position) |
038 | npc.Humanoid:MoveTo(point 3. Position) |
039 | npc.Humanoid:MoveTo(point 4. Position) |
040 | npc.Humanoid:MoveTo(point 5. Position) |
041 | npc.Humanoid:MoveTo(point 6. Position) |
042 | npc.Humanoid:MoveTo(point 7. Position) |
045 | local function checkIfPlayerSit() |
046 | for i,v in pairs (game.Players:GetPlayers()) do |
048 | if v.Character.Humanoid.Sit ~ = true then |
049 | v.Character.Humanoid.Health = 0 |
055 | local function challeng_example() |
058 | CreateDialogueEvent:FireAllClients(teacher_Image, "Hello Students!" ) |
061 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "I think this is the School!" ) |
064 | local function challenge_intro() |
066 | CreateDialogueEvent:FireAllClients(teacher_Image, "Hello Students!" ) |
068 | CreateDialogueEvent:FireAllClients(teacher_Image, "Come in the class" ) |
070 | CreateDialogueEvent:FireAllClients(teacher_Image, "sit on the chair please" ) |
071 | TimerEvent:FireAllClients( 10 ) |
076 | local function challenge_ 1 () |
078 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "I heard there was a ghost here" ) |
080 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "Wait really?" ) |
082 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "It was the ghost of the janitor" ) |
084 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "theres no way thats true" ) |
086 | CreateDialogueEvent:FireAllClients(teacher_Image, "Attention class, Theres no such things as ghost" ) |
088 | game.Lighting.Ambient = Color 3. new( 0.176471 , 0.176471 , 0.176471 ) |
089 | game.Lighting.TimeOfDay = "1:00:00" |
090 | game.Lighting.Brightness = 3 |
091 | game.Lighting.FogEnd = 50 |
092 | game.Lighting.FogStart = 10 |
093 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "Huh wheres the light" ) |
095 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "oh no is it the ghost" ) |
097 | CreateDialogueEvent:FireAllClients(teacher_Image, "Its probrobly not ill go check it" ) |
099 | CreateDialogueEvent:FireAllClients(teacher_Image, "stay here dont go anywhere" ) |
102 | game.Workspace [ "Huge Scream" ] :play() |
104 | CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId), "What was that" ) |
108 | local function challenge_ 2 () |
112 | local function challenge_ 3 () |
116 | local function challenge_ 4 () |
120 | local function challenge_ending() |
126 | local function startGame() |
Ponchokings code
ask me if you need question cuz this is my first time posting a long question
Thanks in Advance