Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Dialogue script, nil value? [Skip to line "78", CLICK NOW, i need this for a school project :( ]

Okay, to start of with i created a dialogue script. When i first started scripting i was passionate about dialogues, and wanted to make my custom one.

It actually turned very well! The only problem is when i started expanding on questions i got an error [Line 78] It's saying it's a nil value?


SCRIPT:


local aggromag = 20

local Cam = workspace.CurrentCamera
local Debounce = false

local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")

repeat wait() until Player.Character

local Character = Player.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")

local FocusPart = game.Workspace.FocusPart
local CameraPart = game.Workspace.CameraPart

UIS.InputBegan:Connect(function(InputObject, Processed)
	if Processed then return end

if (HumanoidRootPart.Position - FocusPart.Position).Magnitude < aggromag and InputObject.KeyCode == Enum.KeyCode.E and not Debounce then
	Debounce = true

Cam.CameraType = "Scriptable"
FocusPart.BillboardGui.TextLabel.Visible = false
Cam:Interpolate(CameraPart.CFrame,FocusPart.CFrame, 1)

script.Parent.Visible = true
wait(1)
script.Parent:TweenPosition(UDim2.new(0.319, 0, 0.500, 0))

local WelcomingString = "Hello, I'm maxpax2009, I give you quests you can achieve, Do you want to begin on your mission?"

for i = 1, #WelcomingString do
	script.Parent.Content.Text = string.sub(WelcomingString, 1, i)
	wait(.05)
	
end

for i, option in pairs(script.Parent.Parent.Options:GetChildren()) do
	option.Visible = true
end

wait(5)
Debounce = false

function agree()
	local String = "Okay, your first quest will be to get 300 Points, and you will get a prize!"
	
	for a = 1, #String do
		script.Parent.Content.Text = string.sub(String, 1, a)
		wait(.05)
		
		script.Parent.Parent.Quest.Visible = true
		script.Parent.Parent.Quest:TweenPosition(UDim2.new(0.571, 0, 0.036, 0))
		
		script.Parent.Parent.Quest.Text = "Get 300 Points and return to Max"
	end
end

function Anwer()
wait(4)
for i, option in pairs(script.Parent.Parent.Options:GetChildren()) do
	option.Visible = false

Cam.CameraType = "Custom"
script.Parent.Position = UDim2.new(0.211, 0, -0.444, 0)
FocusPart.BillboardGui.TextLabel.Visible = true
Cam.CameraSubject = Player.Character.Humanoid
script.Parent.Visible = false


end
end
end
end)

script.Parent.Parent.Options.Agree.Activated:Connect(function()
	agree()
	wait(1)
	Anwer()
end)

4 comments

0

I by accident wrote "Anwer", well i guess it's okay lol

0

but line 79 is a wait...?

0

Sorry! Line 78!!

0

Has anyone got an idea? I'm struggling to find out what the problem is?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.