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

How do i make this compatible with a stringvalue? Note this is a datasave script

How do i make these 2 compatible?

function loadScore2(player, clickCounter)
	local score = player:LoadNumber("DevilFruit") 

	if score ~= 0 then
		clickCounter.Value = score
	else
		print("Nothing to load/score was 0")
	end

end

		local clicks2 = Instance.new("StringValue")
		clicks2.Name = "DevilFruit"
		clicks2.Value = ""

1 answer

Numbers and strings are already compatible, what you have there is fine. Although, you can use tostring() and tonumber().

Note: This may not answer your question, but I will put a code block with another possible answer under it.

Script:

function loadScore2(player, clickCounter)
	local clicks2 = Instance.new("StringValue")
	clicks2.Name = "DevilFruit"
	clicks2.Value = ""
	local score = player:LoadNumber("DevilFruit") 
	if score ~= 0 then
		clicks2.Value = score
	else
		print("Nothing to load/score was 0")
	end
end

Tip

Don't use spaces for code, use tab. Tab is faster, and easier. E.G:

if blah then
    -- oke
end

--vs tab:

if blah then
	-- oke
end

Hard to see difference, but it's better

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