Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago
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

Log in to vote
0
Answered by 9 years ago

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?

Ad

Answer this question