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

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

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

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)

1 comment

0

it givs the play a 3 tools from a kit

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)

2 comments

0

Is this the script in the LocalScript?

0

yes i was at the moveis so i wasent able to reply

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