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

Attempt to call a nil value on something that exists? line 14 server script

Explorer Image

http://www.google.com/search?tbs=sbi:AMhZZiuiYhOPDNt6Ik8BY0qwpPA7_1zdeRVVxpsXJZ1PEHHeOOZheB32mDl5npVJwWPDOzdcjLqJIYhiUx2N8vcg1BBtK9Erwll-aU-bCN5sD7wnneqYNunHjsc33HBRcIk3ZX_1p-91lWiy8DvDADaDKt22rm5mZgFNRQ0SPyRWt95QDaDihRcOfzXpQYxiukBJIbIVs0QsmcgCTx-f8Uxq54NLz4VPafqfK4x3-DMgcsouw1XMG5U5wnLhM99mQ68jN-mbTbKTBNlbRgqd0VNhngkOnmjHkvRAKIcdCHKZuXa2QGWeymVlrHVYO9zWcOl0JdOiW9LJVcMWUWcew-HCH0IRp1g3U9uA&hl=en-CA

-- Local Script

local sss = game:GetService("ServerScriptService")
local rs = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local player = players.LocalPlayer
local remotes = rs:WaitForChild("Remotes")
local lick4 = remotes.Lick2
local lolipop4 = script.Parent
local mouse = player:GetMouse()
local clicked = false
local licktimeModule = require(rs.toolLick)
local char = player.Character or player.CharacterAdded:wait()
local backpack = player:WaitForChild("Backpack")
local tool_Name4 = script.Parent.Name
local tool4 = script.Parent
local soundService = game:GetService("SoundService")
local sounds = soundService:WaitForChild("Sounds")
local licksound = sounds.lickSound

lolipop4.Activated:Connect(function()
	
	
	if not clicked then
	
		clicked = true
		lick4:FireServer(tool_Name4,tool4)
		licksound:Play()
		licktimeModule.TringPop1cooldown()
		clicked = false
		
		
	end
	
end)
-- Server Script 

lick2.OnServerEvent:connect(function(player,tool4,tool_Name4)-- TringPop1 Event Fired
		warn("Lick2 event fired")
		
		print(tool_Name4)
		local dataFolder = playerdata:FindFirstChild(player.Name)
		
		
		if not	dataFolder then 
			return ("noFile")
		else
			
			local lickAdditionValue4 = tool4:FindFirstChild("TringPop1lickValue").Value
			player.leaderstats.Licks.Value = player.leaderstats.Licks.Value + lickAdditionValue4
			 
			
			while wait() do
				for i,v in pairs (backpack:GetChildren() and char:GetChildren()) do
					if v == tool4 or v.Name == tool_Name4 then
						print("Tool1 found")
						if player.leaderstats.Licks.Value == (136) then
							player.leaderstats.Licks.Value = player.leaderstats.Licks.Value - lickAdditionValue4
							
						end
					end
				end
				break
			end
		end 
			wait(5)
			print(player.leaderstats.Licks.Value)
			
	end)-- TringPop1 Event End

1 comment

1

Give context for your questions not just a wall of text...

1 answer

i think you might have mixed up the variables in firing the server in line 27 inside the local script you wrote

lick4:FireServer(tool_Name4,tool4)

but in the server script line 3 you have

lick2.OnServerEvent:connect(function(player,tool4,tool_Name4)

so tool4 and tool_name4 switched variables and in line 14 you have

local lickAdditionValue4 = tool4:FindFirstChild("TringPop1lickValue").Value

you can't check the value of a name

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