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

"15:20:40.020 - ServerScriptService.ShopBuy(Brute):8: attempt to index a nil value" Why?

Asked by 4 years ago

Ok the code is below and i tried if clone then that just didnt even do anything at all......

local Classes = game.ReplicatedStorage:WaitForChild("Classes")
local Baton = game.ReplicatedStorage.Classes.Brute.Baton
local RocketLauncher = game.ReplicatedStorage.Classes.Brute.RocketLauncher
local Shotgun = game.ReplicatedStorage.Classes.Brute.Shotgun
------------------------------------------------------------------
game.ReplicatedStorage.ShopBuy.OnServerEvent:Connect(function(player,Brute)
-------------------------------------------------------------------------
    local clone = Classes.Brute:FindFirstChild(Shotgun):Clone()
    if clone then
    clone.Parent = player.Backpack
    end
    -------------------------------
    local clone2 = Classes.Brute:FindFirstChild(Shotgun):Clone()
    if clone2 then
    clone2.Parent = player.StarterGear
    ------------------------------------------------------
    local clone3 = Classes.Brute:FindFirstChild(RocketLauncher):Clone()
    if clone3 then
    clone3.Parent = player.Backpack
    -------------------------------
    local clone4 = Classes.Brute:FindFirstChild(RocketLauncher):Clone()
    if clone4 then
    clone4.Parent = player.StarterGear
    --------------------------------------------------------
    local clone5 = Classes.Brute:FindFirstChild(Baton):Clone()
    if clone5 then
    clone5.Parent = player.Backpack
    -------------------------------
    local clone6 = Classes.Brute:FindFirstChild(Baton):Clone()
    if clone6 then
    clone6.Parent = player.StarterGear
    end
        end
            end
                end

                    end
                        end)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

First things first what is the script's job?

Like give player a tool?

Or is it like some sort of touch pads or tool giver?

Also can you please send the "LocalScript" code that this script is connected to?

For Example--

LocalScript:

game.Workspace.RemoteEvent:FireServer(Variable, AnotherVariable)

ServerScript(Which Is Where The Problems Are Right Now):

game.Workspace.RemoteEvent.OnServerEvent:Connect(function(Variable, AnotherVariable)

0
it givs the play a 3 tools from a kit AshamedLeader 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local price = script.Parent.ItemPrice
local price2 = script.Parent.Parent.Parent.Info.Price
local price3 = script.Parent.Parent.Parent.Info.ItemPrice
local name = script.Parent.ItemName
local name2 = script.Parent.Parent.Parent.Info.ItemName
local image = script.Parent.ItemImage
local image2 = script.Parent.Parent.Parent.Info.ItemImage

script.Parent.MouseButton1Click:connect(function()
    price2.Value = price.Value
    price3.Text = price.Value
    name2.Value = name.Value
    image2.Image = image.Value
end)
0
Is this the script in the LocalScript? Chontex 0 — 4y
0
yes i was at the moveis so i wasent able to reply AshamedLeader 0 — 4y

Answer this question