Hello everybody!!! I’m back! But now with a new problem with scripting. I feel I may be nagging a bit, but I really need help with this. So, I tried a whole new approach to the script and decided to make it switch between the NPC talking and a random player talking. Again, I DID try following the tutorial for this script, (this script is by rubyboo4) but will not work. If I could get some help, that would be awesome!
local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
local randomPlayerName
local randomPlayerID
local function getRandomPlayer()
local players = game.Players.getPlayers()
local number = math.random(1,#players)
local randomPlayer = players[number]
randomPlayerName = randomPlayer.Name
randomPlayerID = randomPlayer.UserID
end
local function challeng_example()
local noob_image = "rbxassetid://4999968209"
CreateDialogueEvent:FireAllClients(noob_image,"Dialogue Here")
wait(5)
getRandomPlayer()
CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerID),"Dialogue Here")
end
local function challenge_intro
wait(10)
getRandomPlayer()
CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerID),"You can say that again. I can't wait to play at the park!")
wait(4)
local noob_image = "rbxassetid://4999968209"
CreateDialogueEvent:FireAllClients(noob_image, "So what are we waiting for? Let's go!!!")
wait(5)
game:GetService("StarterGui"):FindFirstChild("TalkingNPC").Frame.Visible = false
end
local function challenge_1()
end
local function challenge_2()
end
local function challenge_3()
end
local function challenge_4()
end
local function challenge_ending()
end
local function startGame()
challenge_intro()
challenge_1()
challenge_2()
challenge_3()
challenge_4()
challenge_ending()
end
wait(10)
startGame()
This is my code. There are multiple events here that you shouldn’t worry about. Please let me know if you can fix it! (Lua really isn’t my strongest coding language. )
Edit: When I go into a test, nothing happens in the output table. Literally nothing. What doesn’t seem to be working is probably that I forgot to add a OnClientEvent, but I’m not sure.