Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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

Ad

Answer this question