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

Error: attempt to call a Instance value how do I fix this?

This is my code:

local replicatedstorage = game:GetService("ReplicatedStorage")
local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")

local cooldown = 1

replicatedstorage.Remotes.Lift.OnServerEvent:Connect(function(player)
	
	if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
	
	local debounce = remoteData(player.Name).Debounce.Value 
	
	if not debounce.Value then
		debounce.Value = true
		
		player.leaderstats.Strenght.Value = player.leaderstats.Strenght.Value + 25 * (player.leaderstats.Rebirths.Value + 1)
		
		wait(cooldown)
		
		debounce.Value = false
	end
end)


Im getting this error: attempt to call a Instance value on line 10 (local debounce = remoteData(player.Name).Debounce.Value)

1 answer

Change local debounce = remoteData(player.Name).Debounce.Value to local debounce = remoteData(player.Name).Debounce and all should be fine; it is because you are trying to call Value.Value here (line 10-13)

    local debounce = remoteData(player.Name).Debounce.Value
	 
	    if not debounce.Value then
	        debounce.Value = true

Hope this helps!

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