ServerScript: (This script is a server script, not a localscript)
local NPC = script.Parent.Parent -- who is talking (in this case workspace.NPC)
local CC = Enum.ChatColor.White -- you can change Red to Blue, Green or White
local waittime = 2 -- time you have to wait for each message
--guts (DONT TOUCH)
local function Chat(message: string, color)
game:GetService("Chat"):Chat(NPC.Head, message, CC)
end
local function Jump()
NPC.Humanoid.Jump = true
end
local function Move(pos: Vector3, spawn_thread)
spawn_thread = spawn_thread or false
NPC.Humanoid:MoveTo(pos)
if not spawn_thread then NPC.Humanoid.MoveToFinished:Wait() end
end
local walkpoint = script.Parent.Parent.WalkPoints
--CHAT AND MOVE
wait(15)
Chat("A gun! My gun!!!")
Move(walkpoint["1"].Position) -- you can add this to a certain part so the NPC moves in order of the walkpoints (workspace.WalkPoints)
wait(waittime)
Chat("bruh")
wait(waittime)
Chat("i cant pick it up :/")
Move(walkpoint["2"].Position) -- make sure you change the number also
wait(waittime)
Chat(";gun")
wait(waittime)
game.Workspace.Handgun.Parent = game.Workspace.NPC
Jump()
Chat("YAY")
wait(2)
Chat("BRUH")
wait(2)
Chat("I GOT STUCK NOOO")
wait(2)
Chat("hmm")
wait(2)
Chat("i should download an exploit, wait 15 secs")
wait(15)
Chat(";fly")
wait(2)
game.Workspace.NPC:BreakJoints()
wait(2)
game.Workspace.NPC:Destroy()
wait(3)
game.Players.LocalPlayer.Character:Destroy()
Error: attempt to index nil with 'Character'

1 comment
'LocalPlayer' can only be used in localscript not server scripts. To have Local Script and Server scripts communicate together use RemoteEvents: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events