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

My script to make a fighting shedletsky works, only If he can say one thing how can I fix this?

Asked by 2 years ago

So I am making a shedletsky npc that shoots a laser gun the problem Is where the talking scripts only works If there Is only one phrase there

Script:

local NPC = script.Parent
local phrases = {
    "Get pwnd!"
    "Your gotta duel me? ROLF!!!"
    "Never got PWND, and never will!"
    "ROLF"
    "Man the way imnotaguest1121 programmed me ngl"
    "GG, but I always win!"
    "Hey guys! Shedletsky here and I'm gotta PWND a user!"
    "imnotaguest1121! Buff me!"
    "Shedletsky Is here!"
}

while wait(1) do
    game:GetService("Chat"):Chat(script.Parent.Head, phrases[math.random(1, #phrases)], Enum.ChatColor.White)
end
0
This is an easy fix, just add a comma, or semi-colon after each phrase to separate them. You should consider reading about tables: https://developer.roblox.com/en-us/articles/Table MarkedTomato 810 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Add , or ; after phrases

example:

local phrases = {
    "Get pwnd!",
    "Your gotta duel me? ROLF!!!",
    "Never got PWND, and never will!",
    "ROLF",
    "Man the way imnotaguest1121 programmed me ngl",
    "GG, but I always win!",
    "Hey guys! Shedletsky here and I'm gotta PWND a user!",
    "imnotaguest1121! Buff me!",
    "Shedletsky Is here!"
}
Ad

Answer this question