#is there a max amount of remove events i can have pending atonce?
1 messages Β· Page 1 of 1 (latest)
wtf is this lol, aint any way to optimize??!??!?!?!
what are you even trying to do????
update inventory
π₯
π₯ π₯ π₯ π₯ π₯
π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯ π₯
is ts satireπ π₯ π«π«π«π«
use one remote bro
Itβs single player game
Ok still use it
Try to hel[p in scripting help challenge
this is what worked for me
local function connectChangedEvents(instances, callback)
for _, instanceName in ipairs(instances) do
local inst = playerstats:WaitForChild(instanceName)
inst.Changed:Connect(callback)
end
end
local equipmentStats = {
"SkillSlot1", "SkillSlot2", "SkillSlot3",
"Weapon",
"ToolSlot1", "ToolSlot2",
"SkillBind1", "SkillBind2", "SkillBind3",
"ToolBind1", "ToolBind2"
}
connectChangedEvents(equipmentStats, LoadEquipment)
-- Backpack events
backpack = game.ReplicatedStorage.Backpacks[player.Name]
backpack.ChildAdded:Connect(LoadBackpackItems)
backpack.ChildRemoved:Connect(LoadBackpackItems)
but u havent reduced the amount of connections
at all
π₯
local function connectChangedEvents(instances, callback)
for _, instanceName in ipairs(instances) do
local inst = playerstats:WaitForChild(instanceName)
inst.Changed:Connect(callback)
end
end
local equipmentStats = {
"SkillSlot1", "SkillSlot2", "SkillSlot3",
"Weapon",
"ToolSlot1", "ToolSlot2",
"SkillBind1", "SkillBind2", "SkillBind3",
"ToolBind1", "ToolBind2"
}
game.ReplicatedStorage.EquipmentChanged.Event:Connect(function()
LoadEquipment()
end)
connectChangedEvents(equipmentStats, function()
game.ReplicatedStorage.EquipmentChanged:Fire()
end)
backpack = game.ReplicatedStorage.Backpacks[player.Name]
backpack.ChildAdded:Connect(LoadBackpackItems)
backpack.ChildRemoved:Connect(LoadBackpackItems)```
make sure to create a bindable event not a remote event since you said ur game is singleplayer
What does this achieve?
because it gives you a single centralized channel instead of like 20 direct .changed connections
loading each stat one by one is just inefficient π
instead of game.ReplicatedStyorage.EquipmentChange:Fire()
can i just use a function i alr made in the script?
sorry im kinda bad at optimizing type shit
function as in bindableevent
u can use a remoteevent but bindableevent is better since its a singleplayer game
Singleplayer with multiplayer options (story game but you cna coop with 4 people) so i handle gui still on client
then use remoteevents yeah, should be a lil safer too
should i check stats on server then send to client or just do everything on client for the gui?