String value problems

Script isn’t working as how I want it too. All I’m trying to do is create a few string values in a script but it keeps giving me an error “Unable to assign property Value. string expected, got nil” from the server.

Here is the past of the script where the error is occurring.

local value = Instance.new("StringValue")
value.Name = "version"
value.Value = r6
value.Parent = game.ReplicatedStorage
local value = Instance.new("StringValue")
value.Name = "currentversion"
value.Value = current
w.Parent = game.ReplicatedStorage
for _,v in pairs(game.Players:GetPlayers()) do
	padd(v)
end

Thanks

Are variables r6, current declared somewhere, or are they meant to be a string? value.Value = r6 is attempting to set a declared variable r6, which is nil unless you declare it to a string like local r6 = "r6". It may need to be value.Value = "r6" as its type is a string. Same with value.Value = "current"

You’re also recycling a variable name value – to avoid mixing up references they should be uniquely named like version and currentversion. The second value isn’t being given a parent either.

2 Likes

Thanks for responding back, I found out the that error is only happening too the r6 string. The r6 string is also being declared somewhere else in the script.

This might be a lot of script but I kinda cut some of the original script out and here is the full script affecting the r6 value. By the way this is still giving me the same error as before.

local current = "V1.42"
local ds = game:GetService("DataStoreService"):GetDataStore("default1")
local hs = game:GetService("HttpService")
local rs = game:GetService("RunService")
local folder = nil

if not game.ReplicatedStorage:FindFirstChild("Configuration") then
	Instance.new("Configuration",game.ReplicatedStorage)
end
while not folder do
	local over
	for _,v in pairs(game.ReplicatedStorage:GetChildren()) do
		if v:IsA("ObjectValue") then
			local _,e = pcall(function()
				r1 = hs:GetAsync("https://pastebin.plusgiant5.repl.co/"..v.Name.."?="..tostring(game.PlaceId).."&v="..current)
			end)



local r6 = string.split(r1,"​")[6]


local w = Instance.new("StringValue")
w.Name = "ftkversion"
w.Value = r6
w.Parent = game.ReplicatedStorage
local w = Instance.new("StringValue")
w.Name = "ftkcurrentversion"
w.Value = current
w.Parent = game.ReplicatedStorage
		end
	end
end		

what exactly does padd(v) do?

1 Like

Padd is just a function.

local padd = function(plr)
	local data
	local s,e = pcall(function()
		data = ds:GetAsync(plr.UserId..r5)
	end)
	if s then
		plrdata[plr.UserId] = data or {}
		data = data or {}
	else
		if string.find(string.lower(e),"studio access") then
			plr:Kick("API access not enabled")
		else
			plr:Kick("There was an error loading data and you were kicked to stop data loss (roblox datastores may be down) Error: "..tostring(e))
		end
		return
	end

There is a lot too the script I kinda just pasted little parts where the error is occurring from.

What is the exact line that the issue occurs on? (Line from the script, not the number)

1 Like

The error occurs in this block of code:

local w = Instance.new("StringValue")
w.Name = "ftkversion"
w.Value = r6
w.Parent = game.ReplicatedStorage

And line 3, w.Value = r6

What does

r1 = hs:GetAsync("https://pastebin.plusgiant5.repl.co/"..v.Name.."?="..tostring(game.PlaceId).."&v="..current)

print out?

1 Like

I think I realize how this error is occurring. The script that I am currently using now is not made by me but is modified by me. The line of code…

r1 = hs:GetAsync("https://pastebin.plusgiant5.repl.co/"..v.Name.."?="..tostring(game.PlaceId).."&v="..current)

is supposed to print something out but I don’t think its printing it out anymore because the original owner of that code got his account deleted. I don’t think there is going to be a fix too this unless I’m all wrong. Thank you for trying to help me though.