Hey Devforum! I want to make a player get a sword automatically if they have enough time. So for example if player chareou just got 500 time then automatically reward them with a sword, I already have a datastore and all that. I have no idea how to actually implement this without having lag issues. I’ve tried :RenderStepped to check if they have the wanted time. Whats happening now is that when a player clicks a button it gives them the sword (if they have time) and then saves. I’m using the ProfileService module made by loleris and a Remote Event. My main issue is that ProfileService can only be called from a serverscript. Also, there is multiple swords.
Remote Event
local remote = game:GetService("ReplicatedStorage").OnRequest
remote.OnServerEvent:Connect(function(client, request)
local inventory_folder = inventories[client.Name]
local tool = tools[request]
if inventory_folder:FindFirstChild(tool.Name) then
else
local profile = ProfileCache[client]
if profile ~= nil then
if tool:GetAttribute("TypeOfRequirement") == "Time" then
if profile.Data.Time > tool:GetAttribute("Requirement") then
tool:Clone().Parent = client.Backpack
tool:Clone().Parent = inventory_folder
end
else
if tool:GetAttribute("TypeOfRequirement") == "Kills" then
if profile.Data.Time > tool:GetAttribute("Requirement") then
tool:Clone().Parent = client.Backpack
tool:Clone().Parent = inventory_folder
end
end
end
end
end
end)
wait(7)
If anyone has any idea how to script this then lmk.