local rarityevent = game.ReplicatedStorage.Events.RarityEvent
players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder", plr)
ls.Name = "leaderstats"
local cash = Instance.new("IntValue", ls)
cash.Name = "Cash"
cash.Value = 250
local stars = Instance.new("IntValue", ls)
stars.Name = "Stars"
stars.Value = 0
local totalratings = Instance.new("IntValue", plr)
totalratings.Name = "totalratings"
totalratings.Value = 0
end)
rarityevent.Event:Connect(function(plr, rarity)
plr:WaitForChild("totalratings").Value += 1
local currentStars = plr.leaderstats.Stars.Value / plr.totalratings.Value
plr.leaderstats.Stars.Value = math.floor(currentStars)
end)
#why is my script not wokring?
1 messages · Page 1 of 1 (latest)
please ping me if you reply, thanks!
i will try this right now, thank you so much!
let me know if it works
alr thanks
try that now
same thing
fair enough
wait
let me see something
its in this function so i think thats why it doesnt work since plr isnt used correctly: ```local function getfoodinInventory(plr)
if isTaken == false then
local chosenfood, rarityKey = moduletable.ChooseFood() --chosen food from the module script
if chosenfood then
wait(cooktime)
local visiblefood = food:FindFirstChild(chosenfood.Name) --finds the food inside of the food inside of the frying pan
for i, v in ipairs(visiblefood:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
prox.ActionText = "Take"
currentfood = chosenfood
currentVisibleFood = visiblefood
local rarity = tonumber(rarityKey)
rarityEvent:Fire(plr, rarity)
print(rarity)
end
end
end
end
end
yeah that was the error
yes now im rewriting the stars / totalratings since that didnt work
fair
thank you for your time
np
it works!
awesome i shoudlve really asked what the error was from the start lol but glad it works