Hello! I am asking once again....
I am just a beginner so I don't know why my script won't work...
This is my General Script where I tried creating a save stat system but it didn't work....
local datastore = game:GetService("DataStoreService")
local mydatastore = datastore:GetDataStore("DataStorage")
local playerTable = {}
local rp = game.ReplicatedStorage
-- Save Data
game.Players.PlayerAdded:Connect(function(player)
playerTable[player] = {Level = 0,Experience = 0,Str = 0,Inventory = 0}
local currentLevel = mydatastore:GetAsync("savedlevel"..player.UserId)
local currentExp = mydatastore:GetAsync("savedExp"..player.UserId)
local currentStr = mydatastore:GetAsync("savedStr"..player.UserId)
local currentinventory = mydatastore:GetAsync("savedinventory"..player.UserId)
playerTable[player].Level = currentLevel
playerTable[player].Experience = currentExp
playerTable[player].Str = currentStr
playerTable[player].Inventory = currentinventory
wait(1)
player.PlayerGui.Main.Inventory.ScreenGui.StatsFrame.Frame.LevelValueText = playerTable[player].Level
player.PlayerGui.Exp.Frame.xpValue.Text = playerTable[player].Experience
end)
-- Save Data
-- Give Data
rp.sCrystalTrig.OnServerEvent:Connect(function(player)
playerTable[player].Experience = playerTable[player].Experience + 1
wait(0.6)
player.PlayerGui.Exp.Frame.xpValue = playerTable[player].Experience.."/".. 10
wait()
end)
-- Give Data
The script inside it
local sCrystal = script.Parent
local rp = game.ReplicatedStorage
sCrystal.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent:FindFirstChild("HumanoidRootPart") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
rp.sCrystalTrig:FireClient(player)
print("Consumed")
end
end
end)
For me I think the problem is in the General script because the script in the part is working ("shows print text")
So basically I wanted to gain experience when I touch the part.... but the experience is not changing text in my Gui whenever I touch the part; It only sends me the Consumed text in output.
Any help is appreciated and Thanks in advance!

3 comments
sended u my f.r
Um can I send u a friend request on dis and u help me with my scripting problem? (My user is idk v.2)
*idk v.2 #1003