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
#Intvalues not saving when leaving game
44 messages · Page 1 of 1 (latest)
** You are now Level 1! **
anyone please help me
One message removed from a suspended account.
One message removed from a suspended account.
i already got i wokring after hours looking on how i can get it to save but the methode im using is not safe cause its colecting data via localscripts
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)
One message removed from a suspended account.
One message removed from a suspended account.
i have a local script inside the tool once the person klicks it adds 1 to the intvalue located inside the player stats folder
One message removed from a suspended account.
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
One message removed from a suspended account.
yea i learned that but i have no idea and how to change the intvalues on the server when 1 player clicks on the tool
One message removed from a suspended account.
inside the tool ?
One message removed from a suspended account.
One message removed from a suspended account.
yea i have mine there
how would i use this ?
One message removed from a suspended account.
One message removed from a suspended account.
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 ?
One message removed from a suspended account.
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 ?
** You are now Level 2! **
its my first time working with these
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i see but dont i need to also give to player with the fireserver function ?
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.
ohhh alr
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
il try to inplement everything il let you know if i have problems
One message removed from a suspended account.
thx for the help alr tho this helps alot