local player = game.Players.LocalPlayer
-- Čekání na StarsSystem
local starsSystem = player:WaitForChild("StarsSystem", 10)
if not starsSystem then
warn("StarsSystem not found!")
return
end
-- Čekání na Stars
local stars = starsSystem:WaitForChild("Stars", 10)
if not stars then
warn("Stars not found in StarsSystem!")
return
end
-- Čekání na StarsTimeSystem
local starsTimeSystem = player:WaitForChild("StarsTimeSystem", 10)
if not starsTimeSystem then
warn("StarsTimeSystem not found!")
return
end
-- Čekání na Star"x"Time
local starTimes = {
starsTimeSystem:WaitForChild("Star1Time", 10),
starsTimeSystem:WaitForChild("Star2Time", 10),
starsTimeSystem:WaitForChild("Star3Time", 10),
starsTimeSystem:WaitForChild("Star4Time", 10),
starsTimeSystem:WaitForChild("Star5Time", 10),
}
local function updateStars()
for i = 5, 1, -1 do
if starTimes[i].Value <= 0 then
stars.Value = math.max(stars.Value - 1, 0)
break
end
end
end
for i = 1, 5 do
starTimes[i].Changed:Connect(updateStars)
end
-- Odečítání od Star"x"Time každou sekundu
while false do
wait(1)
for i = 1, 5 do
if starTimes[i].Value > 0 then
starTimes[i].Value = starTimes[i].Value - 1
end
end
end
#Stars system , but no work on 100% only on 50%
46 messages · Page 1 of 1 (latest)
game:GetService("Workspace")["TESTOVACÍ VĚCI"].Skripty.StarTimeADD.Main.Part.ClickDetector.MouseClick:Connect(function(plr)
print("fungjav")
if plr.StarsSystem.Stars.Value == 1 then
plr.StarsTimeSystem.Star1Time.Value += 1
print(plr.StarsTimeSystem.Star1Time.Value)
else if plr.StarsSystem.Stars.Value == 2 then
plr.StarsTimeSystem.Star2Time.Value += 1
print(plr.StarsTimeSystem.Star2Time.Value)
else if plr.StarsSystem.Stars.Value == 3 then
plr.StarsTimeSystem.Star3Time.Value += 1
print(plr.StarsTimeSystem.Star3Time.Value)
else if plr.StarsSystem.Stars.Value == 4 then
plr.StarsTimeSystem.Star4Time.Value += 1
print(plr.StarsTimeSystem.Star4Time.Value)
else if plr.StarsSystem.Stars.Value == 5 then
plr.StarsTimeSystem.Star5Time.Value += 1
print(plr.StarsTimeSystem.Star5Time.Value)
end
end
end
end
end
end)
game:GetService("Workspace")["TESTOVACÍ VĚCI"].Skripty.StarTimeADD.Main["-Part"].ClickDetector.MouseClick:Connect(function(plr)
print("fungjav")
if plr.StarsSystem.Stars.Value == 1 then
plr.StarsTimeSystem.Star1Time.Value -= 1
print(plr.StarsTimeSystem.Star1Time.Value)
else if plr.StarsSystem.Stars.Value == 2 then
plr.StarsTimeSystem.Star2Time.Value -= 1
print(plr.StarsTimeSystem.Star2Time.Value)
else if plr.StarsSystem.Stars.Value == 3 then
plr.StarsTimeSystem.Star3Time.Value -= 1
print(plr.StarsTimeSystem.Star3Time.Value)
else if plr.StarsSystem.Stars.Value == 4 then
plr.StarsTimeSystem.Star4Time.Value -= 1
print(plr.StarsTimeSystem.Star4Time.Value)
else if plr.StarsSystem.Stars.Value == 5 then
plr.StarsTimeSystem.Star5Time.Value -= 1
print(plr.StarsTimeSystem.Star5Time.Value)
end
end
end
end
end
end)
game:GetService("Workspace")["TESTOVACÍ VĚCI"].Skripty.StarADD.Main.Part.ClickDetector.MouseClick:Connect(function(plr)
plr.StarsSystem.Stars.Value += 1
print(plr.StarsSystem.Stars.Value)
end)
game:GetService("Workspace")["TESTOVACÍ VĚCI"].Skripty.StarADD.Main["-Part"].ClickDetector.MouseClick:Connect(function(plr)
plr.StarsSystem.Stars.Value -= 1
print(plr.StarsSystem.Stars.Value)
end)
local DataStoreService = game:GetService("DataStoreService")
-- Nastavení scope na "Stars"
local scope = "Stars"
local PlayerStars = DataStoreService:GetDataStore("PlayerStars")
game.Players.PlayerAdded:Connect(function(player)
local StarsSystem = Instance.new("Folder")
StarsSystem.Name = "StarsSystem"
StarsSystem.Parent = player
local Stars = Instance.new("IntValue")
Stars.Name = "Stars"
Stars.Parent = StarsSystem
-- Získání hvězd ze služby DataStore
local success, currentStars = pcall(function()
return PlayerStars:GetAsync(scope .. "_" .. player.UserId)
end)
if success and currentStars ~= nil then
Stars.Value = currentStars
else
Stars.Value = 0
end
-- Cyklus pro kontrolu změny hodnoty hvězd
local lastStarsValue = Stars.Value
while true do
task.wait(10)
-- Pokud se hodnota hvězd změnila, aktualizuj ji
if Stars.Value ~= lastStarsValue then
local success, updatedValue = pcall(function()
return PlayerStars:UpdateAsync(scope .. "_" .. player.UserId, function(oldValue)
return Stars.Value
end)
end)
if success then
lastStarsValue = Stars.Value
else
warn("Failed to update stars for player: " .. player.Name)
warn("Error details: " .. tostring(updatedValue))
end
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, updatedValue = pcall(function()
return PlayerStars:SetAsync(scope .. "_" .. player.UserId, player.StarsSystem.Stars.Value)
end)
if not success then
warn("Failed to save stars for player: " .. player.Name)
warn("Error details: " .. tostring(updatedValue))
end
end)
5.(1/2)
local DataStoreService = game:GetService("DataStoreService")
-- Nastavení scope na "Stars"
local scope = "StarsTime"
local PlayerStarTimeStores = {
PlayerStar1Time = DataStoreService:GetDataStore("PlayerStar1Time"),
PlayerStar2Time = DataStoreService:GetDataStore("PlayerStar2Time"),
PlayerStar3Time = DataStoreService:GetDataStore("PlayerStar3Time"),
PlayerStar4Time = DataStoreService:GetDataStore("PlayerStar4Time"),
PlayerStar5Time = DataStoreService:GetDataStore("PlayerStar5Time"),
}
game.Players.PlayerAdded:Connect(function(player)
local StarsTimeSystem = Instance.new("Folder")
StarsTimeSystem.Name = "StarsTimeSystem"
StarsTimeSystem.Parent = player
local Star1Time = Instance.new("IntValue")
Star1Time.Name = "Star1Time"
Star1Time.Parent = StarsTimeSystem
local Star2Time = Instance.new("IntValue")
Star2Time.Name = "Star2Time"
Star2Time.Parent = StarsTimeSystem
local Star3Time = Instance.new("IntValue")
Star3Time.Name = "Star3Time"
Star3Time.Parent = StarsTimeSystem
local Star4Time = Instance.new("IntValue")
Star4Time.Name = "Star4Time"
Star4Time.Parent = StarsTimeSystem
local Star5Time = Instance.new("IntValue")
Star5Time.Name = "Star5Time"
Star5Time.Parent = StarsTimeSystem
-- Načítání hvězd
for i = 1, 5 do
local success, currentStarTime = pcall(function()
return PlayerStarTimeStores["PlayerStar" .. i .. "Time"]:GetAsync(scope .. "_" .. player.UserId)
end)
local starValue = success and currentStarTime or 0
StarsTimeSystem["Star" .. i .. "Time"].Value = starValue
end
-- Cyklus pro kontrolu změny hodnoty hvězd
local lastStarValues = {
Star1Time.Value,
Star2Time.Value,
Star3Time.Value,
Star4Time.Value,
Star5Time.Value,
}
end)
whats this?
- (2/2)
game.Players.PlayerRemoving:Connect(function(player)
-- Uložení všech hvězd při odchodu
for i = 1, 5 do
local success = pcall(function()
return PlayerStarTimeStores["PlayerStar" .. i .. "Time"]:SetAsync(scope .. "_" .. player.UserId, player.StarsTimeSystem["Star" .. i .. "Time"].Value)
end)
if not success then
warn("Failed to save star" .. i .. " for player: " .. player.Name)
end
end
end)
Please help
dms
why did i get pinged
You are script lvl 2, I think you are very good people for helping 😉
It is not your primary but PLEASE 
i mean i would help but all you did is send ALOT of code and didnt even tell what it is outputting and expect me to magically solve it
I know 😦
But you might find it useful
yeah no clue what that is
Loading Stars
** You are now Level 7! **
One is for loading starrs (from database)
seconds is for adding/removing stars
third is for adding/removing starstime
fourth is for loading startime (from database)
fiveth is when Star1Time is 0 remove 1 Star
I am making it 14 days
When I have stars and time get to 0 it will remove me 1 star (good)
but when I add 1 star, it will add me 2! No 1!
you wanna do +=, not =
also here's how your message would be grammatically correct
I want it so that when I have at least 1 star and the decay time reaches 0, and when I add one star it will bring me to 2, not 1.
where?
😄
I want delete 1 star when starTime is 0
stars -= 1
** You are now Level 16! **
I have