Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Argument 1 missing or nil on my story game code from Ponchokings ?

Asked by
Puppynniko 1059 Moderation Voter
3 years ago

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

117:16:52.756  Argument 1 missing or nil  -  Server - gameScript:10
217:16:52.756  Stack Begin  -  Studio
317:16:52.756  Script 'ServerScriptService.gameScript', Line 10 - function getPlayerImage  -  Studio - gameScript:10
417:16:52.756  Script 'ServerScriptService.gameScript', Line 78 - function challenge_1  -  Studio - gameScript:78
517:16:52.756  Script 'ServerScriptService.gameScript', Line 128 - function startGame  -  Studio - gameScript:128
617:16:52.756  Script 'ServerScriptService.gameScript', Line 136  -  Studio - gameScript:136
717:16:52.756  Stack End  -  Studio

this is the code that break it

01local randomPlayerName
02local randomPlayerId
03 
04local function getPlayerImage(player_id)
05    local content, isReady = game:GetService("Players"):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
06    return content
07end
08 
09local 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
15end

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:

01local player = game.Players.LocalPlayer
02local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
03local DialogueFrame = player.PlayerGui.ScreenGui.Frame
04 
05local function playSound(sound_id) -- Plays typing sound
06    local sound = Instance.new("Sound",game.ReplicatedStorage)
07    sound.SoundId = sound_id
08    sound.Volume = .1
09    sound.PlayOnRemove = true
10    sound:Destroy()
11end
12 
13local function textAnimate(content) -- Animates each letter
14    for i=1,string.len(content) do
15        DialogueFrame.TextLabel.Text = string.sub(content,1,i)
View all 34 lines...

Ponchokings code my gameScript code

001local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
002local TimerEvent = game.ReplicatedStorage.TimerEvent
003 
004-- Other Useful Functions
005 
006local randomPlayerName
007local randomPlayerId
008 
009local function getPlayerImage(player_id)
010    local content, isReady = game:GetService("Players"):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
011    return content
012end
013 
014local function getRandomPlayer()
015    local players = game.Players:getPlayers()
View all 136 lines...

Ponchokings code ask me if you need question cuz this is my first time posting a long question Thanks in Advance

0
you have to call the function btw i use ponchokings tutorial for all my story games and his timer script dosn't work just a heads up super00rocket 27 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You didn't fire the function getRandomPlayer() to get the player's UserId. It was only fired in the challenge example function, which isn't called in the code at all. Try firing it in the other challenge function that got called in the code.

Ad

Answer this question