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

Can I store a Value in a Variable to search in Replicated Storage?*Solved*

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local RS = game.ReplicatedStorage


Mouse.KeyDown:connect(function(key)
    key = key:lower() 
    if key == "q" then 
		if Mouse.Target:FindFirstChild("IT") then
			if Mouse.Target:FindFirstChild("SS").Value == 1 then
			local NM = Mouse.Target.NM.Value
			local C = RS.NM:Clone()
			C.Parent = game.Workspace
			
				
			
			
			elseif Mouse.Target:FindFirstChild("SS").Value == 2 then
				print("bye")
				
			
end		
end
end
end)

Errors: NM is not a valid member of ReplicatedStorage

I'm trying to make my own Inventory system to work the way i need it to but It doesnt seem to work. I tried setting up a variable named NM to store a value. And I'm tryign to use that value to search in Replicated sotrage for the same name.

1 answer

FIxed

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local RS = game.ReplicatedStorage


Mouse.KeyDown:connect(function(key)
    key = key:lower() 
    if key == "q" then 
		if Mouse.Target:FindFirstChild("IT") then
			if Mouse.Target:FindFirstChild("SS").Value == 1 then
			local NM = Mouse.Target.NM.Value
			local C = RS:FindFirstChild(NM):Clone()
			C.Parent = game.Workspace
			
				
			
			
			elseif Mouse.Target:FindFirstChild("SS").Value == 2 then
				print("bye")
				
			
end		
end
end
end)

I had to do FindFirstchild(NM) I don't know why though?

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