Tattoo shop not working?

So in my gui, heres the script that sends the value to the server.

local s = script.Parent
local rs = game.ReplicatedStorage
for _,c in pairs(script.Parent.Frame.ScrollingFrame:GetChildren()) do
	if c:IsA("ImageButton") then
		c.MouseButton1Down:Connect(function()
			local tattoo = c.TattooValue.Value
			game.ReplicatedStorage.Remotes.Tattoo:FireServer(tattoo)
		end)
	end
end

but when it gets to the point where it gives them the value in their stats, and put the texture on their face, it doesn’t do it? It gives me a texture string value error.

local facelistthing = {
    [2] = "rbxassetid://4591497668", --Face2
	[4] = "rbxassetid://4591497895", --Face	
}

game.ReplicatedStorage.Remotes.Tattoo.OnServerEvent:Connect(function(plr, tattoo)
	local char = plr.Character
	if tattoo and plr.stats.Cash.Value >= 100 then
		plr.stats.Cash.Value = plr.stats.Cash.Value - 100	
	        if tattoo >= 1 then
			if tattoo >= #facelistthing then
			char:WaitForChild("Head"):WaitForChild("face").Texture = facelistthing[#facelistthing]
			plr.stats.Face.Value = tattoo
			else
			char:WaitForChild("Head"):WaitForChild("face").Texture = facelistthing[tattoo]
			plr.stats.Face.Value = tattoo
			end
	end
	end
end)

any help?

What is TattooValue?

Also why is the code in a quote?

The proper way to do a code block is

```lua

```

local the_proper_way = "To do a code block is"

> Not a blockquote

Not a blockquote

1 Like

The TattooValue is a String Value with the number 2 and 4 in 2 different gui’s.

It gives me a texture string value error.

Please do not paraphrase exception messages. You have left out vital information. Please, copy-paste the exact message, not as an image, to your post.

image

smh i said not as as image but ok


Since you said it was a string value, you’re essentially doing facelistthing["2"] or ["1"]. Arrays are numerically indexed, so you need to use a numerical index. Instead of using a string value, use a number value.

Im sorry, I meant to say number value, not string.

You said in the first reply it was a StringValue. If you store a number in its Value property, the number is just a string representation of a number. It’s still a string. Change it to a NumberValue. Or did I miss something here.

The “tattoovalue” is a NumberValue. Not a string value.

Ok then… are you sure the tattoo you are sending is either 2 or 4? The issue could be you’re using any number other than 2 and 4.

local facelistthing = {
    [2] = "rbxassetid://4591497668", --Face2
	[4] = "rbxassetid://4591497895", --Face	
}

It couldn’t be anything different, its for sure sending as 2 or 4.

Then try some debugging. Print the tattoo values just to be sure.

It printed 2, but still gave me the error. image

Are you absolutely sure it is a number. Print the type of the tattoo.

print(type(tattoo))

Also stop posting images of your code/output