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

attempt to index nil with'value'. can someone help me with this?

speed = 155
MaxFlight = 80
RechargeTime = 0.2
soundstart = "http://www.roblox.com/asset/?id=50909479"
soundhit = "http://www.roblox.com/asset/?id=44463749"
soundend = "http://www.roblox.com/asset/?id=53593789"
soundreloaded = "http://www.roblox.com/asset/?id=97304552"
---------------------------------
wait()

local player = game.Players.LocalPlayer
while player.Character == nil do wait() end
local char = player.Character
while char:FindFirstChild("Humanoid") == nil do wait() end
local hum = char:FindFirstChild("Humanoid")

local tool = script.Parent

DB = false

function playsound(sound)
	local _soundscript = script.PlaySound:clone()
	_soundscript.Parent = sound
	_soundscript.Disabled = false
end


hiddenparts = {}
function hidePart(part)
	local hide = Instance.new("SpecialMesh")
	hide.Name = "TravelHide"
	hide.MeshType = "FileMesh"
	hide.Scale = Vector3.new(0, 0, 0)
	hide.Parent = part
	local isthere = false
	for i = 1, #hiddenparts do
		if hiddenparts[i] == part then
			isthere = true
		end
	end
	if not isthere then
		hiddenparts[#hiddenparts+1] = part
	end
end

function unSelect()
	clickhold = false
end

tool.Deselected:connect(unSelect)
tool.Selected:connect(function(mouse)
	mouse.Button1Up:connect(function()
		clickhold = false
	end)
	mouse.Button1Down:connect(function()
		if DB == false then
			if hum:FindFirstChild("DF").Value == false then 
			DB = true
			clickhold = true
			torso = player.Character:FindFirstChild("Torso")
			if torso == nil or mouse.Hit == nil then return end
			wait()
			dir = (mouse.Hit.p - torso.Position).unit
			local part = Instance.new("Part")
			part.Name = "Light"
			part.BrickColor = BrickColor.new("Bright yellow")
			part.Transparency = 0.3
			part.Reflectance = 0.3
			part.CanCollide = false
			part.FormFactor = "Custom"
			part.Size = Vector3.new(4, 4, 8)
			part.TopSurface = 0
			part.BottomSurface = 0
			mesh = Instance.new("SpecialMesh")
			mesh.MeshType = "Sphere"
			mesh.Parent = part
			light = Instance.new("PointLight")
			light.Color = Color3.new(1, 1, 0.5)
			light.Brightness = 3
			light.Range = 8
			light.Parent = part
			local v = Instance.new("BodyVelocity")
			v.Name = "Travel"
			v.maxForce = Vector3.new(1e7, 1e7, 1e7)
			v.P = 125
			v.velocity = dir * speed
			v.Parent = part

			local sound1 = Instance.new("Sound")
			sound1.Name = "StartSound"
			sound1.SoundId = soundstart
			sound1.Volume = 0.5
			sound1.Pitch = 1
			sound1.Parent = player.Character.Head
			game.Debris:AddItem(sound1, 3)
			playsound(sound1)

			local sound2 = Instance.new("Sound")
			sound2.Name = "Sound"
			sound2.SoundId = soundhit
			sound2.Volume = 0.6
			sound2.Pitch = 2
			sound2.Parent = part

			local creator_tag = Instance.new("ObjectValue")
			creator_tag.Value = player
			creator_tag.Name = "creator"
			creator_tag.Parent = part

			local new_script = script.ArrowScript:clone()
			new_script.Parent = part

			if torso == nil then return end
			if hum == nil then return end

			charpart = player.Character:GetChildren()
			for i = 1, #charpart do
				if charpart[i]:IsA("BasePart") then
					hidePart(charpart[i])
				elseif charpart[i]:IsA("Hat") then
					hidePart(charpart[i].Handle)
				end
			end
			local spawnPos = torso.Position + dir
			part.CFrame = CFrame.new(spawnPos, spawnPos + dir)
			local weld = Instance.new("ManualWeld")
			weld.Part0 = torso
			weld.Part1 = part
			weld.C1 = part.CFrame:inverse() * torso.CFrame
			weld.Parent = part
			local g = Instance.new("BodyGyro")
			g.P = Vector3.new(1e7, 1e7, 1e7)
			g.cframe = CFrame.new(spawnPos, spawnPos + dir)
			g.maxTorque = Vector3.new(1e7, 1e7, 1e7)
			g.Parent = part
			part.Parent = player.Character
			new_script.Disabled = false

			player.Character.Head.Transparency = 1
			endloop = false
			amnt = 0
			if clickhold == true then
				while clickhold == true and endloop == false do
					amnt = amnt + 1
					if amnt >= MaxFlight then
						endloop = true
					end
					wait(0.05)
				end
			end
			player.Character.Head.Transparency = 0
			part:remove()
			local sound3 = Instance.new("Sound")
			sound3.Name = "EndSound"
			sound3.SoundId = soundend
			sound3.Volume = 0.4
			sound3.Pitch = 1
			sound3.Parent = player.Character.Head
			game.Debris:AddItem(sound3, 3)
			playsound(sound3)
			for i = 1, #hiddenparts do
				if hiddenparts[i]:FindFirstChild("TravelHide") ~= nil then
					hiddenparts[i]:FindFirstChild("TravelHide"):remove()
				end
			end
			if torso ~= nil then
				local cd_forw = hum:FindFirstChild("ControlDisplay"):FindFirstChild("Forward")
				if cd_forw then
					if cd_forw.Value == false then
						torso.Velocity = torso.Velocity * Vector3.new(0.2, 0.7, 0.2)
					end
				end

			end
			wait(RechargeTime + amnt/15)
			local sound4 = Instance.new("Sound")
			sound4.Name = "ReloadedSound"
			sound4.SoundId = soundreloaded
			sound4.Volume = 0.2
			sound4.Pitch = 1.7
			local tagname, tagid = game.ReplicatedStorage.GetFilterTag:InvokeServer()
			local filtertag = Instance.new("IntValue")
			filtertag.Name = tagname
			filtertag.Value = tagid
			filtertag.Parent = sound4
			sound4.Parent = player:FindFirstChild("PlayerGui")
			sound4:Play()
			game.Debris:AddItem(sound4, 3)
			DB = false
		end
	end)

end)

4 comments

0

what line

0

Line 57

0

whats DF xd

0

oooo found the problem, its missing a folder. but idk how i can add it since its needed to be in "humanoid"

1 answer

✓ Accepted answer

uh u can put a folder in the humanoid with this

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local Humanoid = character:WaitForChild'Humanoid'
		Instance.new('Folder', player.Humanoid).Name = 'NameOfFolder'
	end)
end)

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