local work = game.Workspace
local items = {work.TriggerA,work.TriggerB,work.TriggerC,work.TriggerD} -- everything with dialog

--------------------------------------------

local Cutscene = require(game.ReplicatedStorage.CutsceneModule)
local p = game.Players.LocalPlayer
local character = p.Character
	local humanoid = character:WaitForChild("Humanoid")
local gui = p.PlayerGui:WaitForChild("KeyGui")
local current
gui.Adornee = nil
gui.text.TextTransparency = 1
local cc = true
local talking = false

for _,v in pairs (items) do
	coroutine.resume(coroutine.create(function()
		while wait(0.2) do
			if p.Character and cc == true then--script.CanCheck.Value == true then
				local mag = (p.Character.Torso.Position-v.Position).Magnitude
				if mag <= 8 and not talking then
					print("in bounds")
					current = v
					gui.Adornee = v
					gui.text.TextTransparency = 0
				elseif current == v and not talking then
					print("out of bounds")
					gui.Adornee = nil
					current = nil
					gui.text.TextTransparency = 1
				end
			elseif cc == false and not talking then--script.CanCheck.Value == false then
				gui.Adornee = nil
				current = nil
				gui.text.TextTransparency = 1	
			end
		end
	end))
end

function getItemNum(part)
	for i,v in pairs (items) do
		if part == v then
			return i
		end
	end
	return 0
end

humanoid.Running:connect(function(speed)
	if speed > 10 and talking then
		print("setting talking to false",speed)
		talking = false
	end
end)

local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(key,processed)
	if key.KeyCode == Enum.KeyCode.E and current and current:IsA("BasePart") then
		if script.Parent.Trigger.Value == 0 then
			cc = false--script.CanCheck.Value = false
			script.Parent.Trigger.Value = getItemNum(current)
			gui.Adornee = nil
			talking = true
			print("hiding text")
			gui.text.TextTransparency = 1
			current = nil
		end
	end
end)
--[[game.workspace.TriggerA.Touched:connect(
	function(prt)
		if game.Players:GetPlayerFromCharacter(prt.Parent) == game.Players.LocalPlayer and script.Parent.Trigger.Value == 0 then
			script.Parent.Trigger.Value = 1
		end
	end
)

game.workspace.TriggerB.Touched:connect(
	function(prt)
		if game.Players:GetPlayerFromCharacter(prt.Parent) == game.Players.LocalPlayer and script.Parent.Trigger.Value == 0 then
			script.Parent.Trigger.Value = 2
		end
	end
)

game.workspace.TriggerC.Touched:connect(
	function(prt)
		if game.Players:GetPlayerFromCharacter(prt.Parent) == game.Players.LocalPlayer and script.Parent.Trigger.Value == 0 then
			script.Parent.Trigger.Value = 5
		end
	end
)
game.workspace.TriggerD.Touched:connect(
	function(prt)
		if game.Players:GetPlayerFromCharacter(prt.Parent) == game.Players.LocalPlayer and script.Parent.Trigger.Value == 0 then
			script.Parent.Trigger.Value = 6
		end
	end
)]]

script.Parent.Trigger.Changed:connect(
	function()
		if script.Parent.Trigger.Value == 1 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(151.332275, 41.1690063, -1005.25366, 0.849798858, 0.168222874, -0.499542773, -0, 0.947706342, 0.319143623, 0.52710712, -0.271207899, 0.805359721)
				},
				"Workers",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click", "Click", "Click"
				},
				{
					"Look at all this destruction! It's unbelievable...",
					"You're telling me Matt! How does someone even fix this...",
					"I don't think we can Jeff. "
				},
				
				{
					0
				},
				false,
				{
					nil
				},
				{
					nil
				}
			)
		elseif script.Parent.Trigger.Value == 2 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(142.601624, 43.2501144, -996.093506, -0.491148263, 0.290895969, -0.821068227, -1.49011594e-08, 0.942590773, 0.333950192, 0.871075928, 0.164019078, -0.462951869)
				},
				"Name Here",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click"
				},
				{
					"Speech Here"
				},
				
				{1.5},
				false,
				{
					function()
						QuestionsRight = QuestionsRight+1
					end
				},
				{
					{{"Response 1",3}, {"Response 2",4}} -- 4 to proceed
				}
			)
		elseif script.Parent.Trigger.Value == 3 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(142.601624, 43.2501144, -996.093506, -0.491148263, 0.290895969, -0.821068227, -1.49011594e-08, 0.942590773, 0.333950192, 0.871075928, 0.164019078, -0.462951869)
				},
				"Name",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click"
				},
				{
					"Response"
				},
				
				{1.5},
				false,
				{
					nil
				},
				{
					nil
				}
			)
	elseif script.Parent.Trigger.Value == 4 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(142.601624, 43.2501144, -996.093506, -0.491148263, 0.290895969, -0.821068227, -1.49011594e-08, 0.942590773, 0.333950192, 0.871075928, 0.164019078, -0.462951869)
				},
				"Name",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click", "Click", "Click"
				},
				{
					"Speech1",
					"Speech2",
					"Speech3"
				},
				
				{1.5},
				false,
				{
					nil
				},
				{
					nil
				}
			)
		
	elseif script.Parent.Trigger.Value == 5 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(127.105377, 41.4891281, -1013.65912, 0.888106167, -0.105001301, 0.447484314, -7.4505806e-09, 0.973557234, 0.228443265, -0.459638447, -0.202881873, 0.864622176)
				},
				"Name",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click", "Click", "Click", "Click"
				},
				{
					"Speech",
					"Speech",
					"Speech",
					"Speech"
				},
				{
					0
				},
				false,
				{
					nil
				},
				{
					nil
				}
			)
		elseif script.Parent.Trigger.Value == 6 then
			cc = false
			Cutscene(
				script.Parent.Trigger,
				game.Players.LocalPlayer,
				{
					CFrame.new(110.158669, 42.5564384, -1016.15045, -0.996743739, 0.0184046868, 0.0785068572, -0, 0.973603666, -0.228245899, -0.0806353465, -0.227502674, -0.970433235)
				},
				"Name",
				"", -- a Decal ID to show some picture in the dialog
				{
					"Click", "Click"
				},
				{
					"Speech",
					"Speech"
				},
				{
					0
				},
				false,
				{
					nil
				},
				{
					nil
				}
			)
			
		end
		cc = true
	end
)



So whats happening is Trigger B initiates cutscene/value 2 which has a choice selection option (yes/no). No is cutscene/value 3. Yes is cutscene/value 4. Trigger C is then supposed to initiate a separate cutscene (cutscene/value 5) and Trigger D is to initiate cutscene 6. The problem thats happening is that when Trigger D is pressed, Trigger C initiates cutscene 3 and Trigger D initiates cutscene 4 rather then assigned values (5,6).

1 comment

0

Sorry for the extremely long script.