Tool not being detected in ServerStorage by script

I am experiencing a problem with a tool that is in ServerStorage not being registered by a script as being in ServerStorage. Below is the code as well as a couple of screenshots.

function onClick()
	local player = script.Parent.Parent.Parent.Parent.Parent
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 8042584262) then
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.Frame3.Visible = true
		script.Parent.Parent.Parent.Type.Value = 5
		local ttype = script.Parent.Parent.Parent.Type.Value
		script.Parent.Parent.Parent.Sensor.Value.nf9w8gt:FireServer(ttype)
		game.ServerStorage.Investor:Clone().Parent = player.Backpack
		light2.BrickColor = BrickColor.new("Lime green")
		wait(1.5)
		light2.BrickColor = BrickColor.new("Bright blue")
	end
end


script.Parent.MouseButton1Down:connect(onClick)

image

Local scripts can’t access server storage. Or anything that has server in its name. Move the tools into replicated storage. Since replicated storage can be accessed by the local script

1 Like

I have a duplicate model with a different script. However, it won’t even read the elseif ttype == 4 then. It reads ttype 1 - 3. Any advice on that?


script.Parent.nf9w8gt.OnServerEvent:connect(function(player, ttype)
	if ttype == 1 then
		game.ServerStorage["Economy"]:Clone().Parent = player.Backpack
		light.BrickColor = BrickColor.new("Lime green")
		wait(1.5)
		light.BrickColor = BrickColor.new("Bright blue")
	elseif ttype == 2 then
		game.ServerStorage["First Class"]:Clone().Parent = player.Backpack
		light.BrickColor = BrickColor.new("Lime green")
		wait(1.5)
		light.BrickColor = BrickColor.new("Bright blue")
	elseif ttype == 3 then
		game.ServerStorage["Business+"]:Clone().Parent = player.Backpack
		light.BrickColor = BrickColor.new("Lime green")
		wait(1.5)
		light.BrickColor = BrickColor.new("Bright blue")
	elseif ttype == 4 then
		game.ServerStorage["Investor"]:Clone().Parent = player.Backpack
		light.BrickColor = BrickColor.new("Lime green")
		wait(1.5)
		light.BrickColor = BrickColor.new("Bright blue")
	end
end)

I’m trying a couple of different approaches to it.

This is not a LocalScript, but rather a typical script.

Just move the items in rep storage, it’ll fix the issue. Try it, it works for me

I moved some stuff around and fixed it. I didn’t have to move the tools to rep storage. Thanks!