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

How do I add to this value correctly?

I have this script that's not working I'm trying to make a fishing game where you fish to get money but I want it to show you how many fish you collected how do I add one to a string value?

script.Parent.Touched:connect(function(hit)
	local player = game.Players[hit.Parent.Name]
	player.FishCollected.Value = "0/32" +1
end)

1 answer

✓ Accepted answer
local players = game:GetService("Players")
local fishAmount = 0

script.Parent.Touched:Connect(function(part) -- Use Connect, connect is deprecated.
    fishAmount = fishAmount + 1
    local plr = players:GetPlayerFromCharacter(part.Parent)
    if plr then
        plr.FishCollected.Value = fishAmount.."/32"
    end
end)

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