Im trying to make a script that if you touch it, it will give you +100 for each time you touch
part = script.Parent
game.Players.PlayerAdded:Connect(function(plr)
print(plr.Name)
part.Touched:Connect(function()
leaderstats = plr:FindFirstChild('leaderstats')
if leaderstats then
Yuan = plr:FindFirstChild('Yuan')
if Yuan then
Yuan.Value = Yuan.Value + 100
end
end
end)
end)
LeaderBoard script
datstore = game:GetService("DataStoreService")
local datast1 = datstore:GetDataStore("Yuan")
local datast2 = datstore:GetDataStore("USD")
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder",plr)
folder.Name = "leaderstats"
local Yuan = Instance.new("IntValue",folder)
Yuan.Name = "Yuan"
local USD = Instance.new("IntValue",folder)
USD.Name = "USD"
Yuan.Value = datast1:GetAsync(plr.UserId) or 0
datast1:SetAsync(plr.UserId, Yuan.Value)
USD.Value = datast2:GetAsync(plr.UserId) or 0
datast2:SetAsync(plr.UserId, USD.Value)
Yuan.Changed:Connect(function()
datast1:SetAsync(plr.UserId, Yuan.Value)
end)
USD.Changed:Connect(function()
datast2:SetAsync(plr.UserId, USD.Value)
end)
end)

3 comments
Mother of god...
What are you so surprised of
Probably the amount of mess that has gone wrong?