How do i fix this error index function with 'Value'

Hello, so I have been working on a minigame type game and I’m trying to make a script for something but in a line I want it to wait a number’s value in replicatedstorage but I keep on getting this error:

index function with ‘Value’

Here is my script:


wait(game.ReplicatedStorage.Remove.Value) -- remove is a number value



Thanks!

Edit: I also tried doing: wait(game.ReplicatedStorage.Remove)

1 Like

Just looked into it, and Instance.remove is also used as a function for removing an object. So you should change the name of the value from “Remove” to something else.

2 Likes

As @kosava said that method should work.

Also can you show the error message?

local value = game.ReplicatedStorage.Remove.Value
wait(value)

Here is the error message: index function with ‘Value’

Here is my full script (its a local script):

game.ReplicatedStorage.TimeLeft.OnClientEvent:Connect(function(c)
	script.Parent.Visible = true
	
	for i = game.ReplicatedStorage.Time.Value,0,-1 do
		local waitTime = game.ReplicatedStorage.Remove.Value
		script.Parent.Show.Text = i
		print(i)
		game.ReplicatedStorage.Click:Play()
		wait(waitTime)
	end
	
	script.Parent.Visible = false
	script.Parent.Show.Text = tostring(game.ReplicatedStorage.Time.Value)
end)

Yes, as @kosava said it’s because your property name is also a function name, so the program got confused.

It’s better to just rename the integer value.

Then you should change it into:

game.ReplicatedStorage.TimeLeft.OnClientEvent:Connect(function(c)
	script.Parent.Visible = true
	
	for i = game.ReplicatedStorage.Time.Value,0,-1 do
		local waitTime = game.ReplicatedStorage:FindFirstChild("Remove").Value
		script.Parent.Show.Text = i
		print(i)
		game.ReplicatedStorage.Click:Play()
		wait(waitTime)
	end
	
	script.Parent.Visible = false
	script.Parent.Show.Text = tostring(game.ReplicatedStorage.Time.Value)
end)

Thanks everyone @kosava 's solution worked when I changed the name it works!