Attempt to index number with 'Value' in a repeat loop

Hey there!

I’m trying to spawn meshparts with a repeat loop but I have a strange errormessage:

This is my script :

local folder = workspace.Game.HipsFolder
local hipsNumber = folder:WaitForChild("NumberOfHips") -- this is an intvalue to count the number of Meshparts
local maxHips = 25
local debounce = false
local module = require(game:GetService("ServerScriptService"):WaitForChild("HipsScripts"):WaitForChild("HipsModule"):WaitForChild("HipsModule"))

repeat
	print("spawn Meshparts")
        hipsNumber.Value = hipsNumber.Value + 1
until hipsNumber.Value == maxHips.Value -- THE ERROR IS AT THIS LINE OF CODE

And this is the output :

  15:04:57.213 - ServerScriptService.HipsScripts.MainHipsScript:10: attempt to index number with 'Value'
15:04:57.213 - Stack Begin
15:04:57.215 - Script 'ServerScriptService.HipsScripts.MainHipsScript', Line 10
15:04:57.215 - Stack End
1 Like

I think the error is pretty clear, you tried to get Value from a number

Change
hipsNumber.Value == maxHips.Value to

hipsNumber.Value == maxHips as maxHips already a number you want to get

1 Like

Oh thx you I forgot this thx :stuck_out_tongue: