--Click detectors
local shopguy = workspace.Map.Speedwagon.ClickDetector
local diavolo = workspace.Map.Diavolo.ClickDetector
local gyro = workspace.Map.Gyro.ClickDetector
local dio = workspace.Map.ShadowDIO.ClickDetector
local josuke1 = workspace.Map["Josuke [Helper NPC]"]
local giorno1 = workspace.Map["Giorno Giovanna"]
local sign = workspace.Sign.Text.ClickDetector
local giorno = giorno1.ClickDetector
local josuke = josuke1.ClickDetector

--Other stuff
local gui = script.RazgovorGUI
local NPCname = gui.NPCName.Text
local dialogue = gui.Dialogue.Text
local data = Player:FindFirstChild("Data")
local dialoguedb = false
local farm = data:WaitForChild("FarmingZone")
local startergui = game:GetService("StarterGui")

Player = game:GetService("Players")["LocalPlayer"]
local playername = Player.Name
local char = Player.Character
local hum = char:WaitForChild("Humanoid")

--Events
local repstorage = game:GetService("ReplicatedStorage")
local zeppelievent = repstorage.ZeppeliInteract
local hamonevent = repstorage.GiveHamon

--Data Detection
local stand = Player:WaitForChild("Data")["Stand"]

--Functions
shopguy.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Speedwagon"
		local line1 = "Wanna buy somethin'?"
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent = shopguy.Parent.Head
		voice.SoundId = "rbxassetid://614988122"
		voice.PlaybackSpeed = 1.25
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(1)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		local shopgui = script.MagazinGUI
		shopgui.Enabled = true
	end
end)
diavolo.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Diavolo"
		local line1 = "I, Diavolo, will reach the truth and defeat Giorno! . . ."
		local line2 = "Wait, who are you?"
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	diavolo.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line2 do
			dialogue.Text = string.sub(line2, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		end
end)
gyro.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Gyro"
		local line1 = "Hey dude, what are you doing here?"
		local line2 = "Why aren't you still in the store behind me?"
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	diavolo.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line2 do
			dialogue.Text = string.sub(line2, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		end
end)
dio.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Shadow DIO"
		local line1 = ". . .*Menacing*. . ."
		local line2 = "Hmph.. i fell Joestar's Blood in you.."
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	dio.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line2 do
			dialogue.Text = string.sub(line2, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		end
end)
josuke.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Higashikata Josuke"
		local line1 = "Hello friend! Welcome to A Different Day!"
		local line2 = "I hope you already have a stand? If not, you can find arrows nearby!"
		local line3 = "If you didn’t like the stand, you can use the rockakaka fruit that will erase your stand."
		local line4 = "Also on the street can be a lot of money that you can spend in the Speedwagon shop!"
		local line5 = "Good luck! I am sure you will find yourself a lot of good friends!"
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	dio.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line2 do
			dialogue.Text = string.sub(line2, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line3 do
			dialogue.Text = string.sub(line3, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(5)
		for i = 1, #line4 do
			dialogue.Text = string.sub(line4, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line5 do
			dialogue.Text = string.sub(line5, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(5)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		end
end)
giorno.MouseClick:Connect(function()
	if not dialoguedb then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Giorno Giovanna"
		local line1 = "I, Giorno Giovanna, have a dream. . ."
		local line2 = "Oh, hi there, stranger."
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	dio.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		for i = 1, #line2 do
			dialogue.Text = string.sub(line2, 1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
		end
end)
sign.MouseClick:Connect(function()
	if not dialoguedb and farm.Value == true then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Farming Zone Teleporter"
		local line1 = "Teleporting. . ."
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	dio.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
	elseif not dialoguedb and farm.Value == false then
		dialoguedb = true
		gui.Enabled = true
		NPCname.Text = "Farming Zone Teleporter"
		local line1 = "Please, buy a Farming Zone ticket at the Speedwagon shop."
		local voice = game.Workspace.SoundLibrary.Voice:Clone()
		voice.Parent =	dio.Parent
		voice.SoundId = "rbxassetid://614988122"
		for i = 1, #line1 do
			dialogue.Text = string.sub(line1, 0.1, i)
			wait(0.05)
			voice:Play()
		end
		wait(3)
		gui.Enabled = false
		dialoguedb = false
		voice:Destroy()
	    end
end)

4 comments

1

You forgot to define the "player" variable

1

Thanks

1

Can you add "[SOLVED]" to the title?

0

^