#Intvalues not saving when leaving game

44 messages · Page 1 of 1 (latest)

broken compass
#

im making a game where people train to gain power i want to make a database to store all the stats but for some reason it just wont store them here is my script if you need more info just ask me for some reason it thinks my stats are always one when i increase my stats via the tool or via explorer it always saves my stats as 1 and not the new value

true minnowBOT
#

studio** You are now Level 1! **studio

broken compass
#

anyone please help me

slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
slate cargo
#

One message removed from a suspended account.

broken compass
# slate cargo One message removed from a suspended account.

local players = game:GetService("Players")
local tool = script.Parent
local last_click = 0
local cooldown = 0.5

tool.Activated:Connect(function()
local player = players:GetPlayerFromCharacter(tool.Parent)

local stats = player:FindFirstChild("Stats")
if not stats then
    warn("Stats folder not found in"..player.Name)
    return
end

local fist_strenght = stats:FindFirstChild("FistStrength")
if not fist_strenght then
    warn("FistStrenght not found in"..player.Name)
    return
end

local fist_strenght_muliplier = stats:FindFirstChild("FistStrengthMultiplier")
if not fist_strenght_muliplier then
    warn("FistStrengthMultieplier not found in"..player.Name)
    return
end

local current_time = tick()

if current_time - last_click >= cooldown then
    local add_fist_strenght = 1 * fist_strenght_muliplier.Value
    fist_strenght.Value +=  add_fist_strenght
    
    
    last_click = current_time

end

end)

slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
#

i have a local script inside the tool once the person klicks it adds 1 to the intvalue located inside the player stats folder

slate cargo
#

One message removed from a suspended account.

broken compass
#

then i have a script thats located inside StarterPlayerScripts that colects all the values in the stats folder and sends them to the server and the server sends them to the database

slate cargo
#

One message removed from a suspended account.

broken compass
slate cargo
#

One message removed from a suspended account.

broken compass
slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
broken compass
slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
#
local players = game:GetService("Players")
local tool = script.Parent
local Rep = game:GetService("ReplicatedStorage")
local Event = Rep:WaitForChild("RemoteEvent")
local last_click = 0
local cooldown = 0.5

tool.Activated:Connect(function()
    local player = players:GetPlayerFromCharacter(tool.Parent)
    
    local current_time = tick()
    
    if current_time - last_click >= cooldown then
          
          Event:FireServer()
          
        last_click = current_time
    
    end
end)```

something like this in the tool then ?
slate cargo
#

One message removed from a suspended account.

broken compass
#

then i need to do the calculation on the server so the player cant acces it but do i need to make a new remotefunction for every tool and stuff ?

true minnowBOT
#

studio** You are now Level 2! **studio

broken compass
#

its my first time working with these

slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
#

i see but dont i need to also give to player with the fireserver function ?

slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
#

ohhh alr

slate cargo
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken compass
#

il try to inplement everything il let you know if i have problems

slate cargo
#

One message removed from a suspended account.

broken compass