Qinrir
(Quin)
November 28, 2021, 1:25pm
#1
Sooooo my body position lags when I parent it to another object at first but dosent lag when i do it the second time… WHY? Does this happen
GravGun.rbxm (39.1 KB)
model for indepth view
Forummer
(Forummer)
November 28, 2021, 1:43pm
#2
Can I see the line of code where you’re parenting the BodyPosition instance?
Forummer
(Forummer)
November 28, 2021, 1:46pm
#3
I’ve discovered a pretty bad performance issue in one of top games that has to do with Instance.new and wanted to write about this, since this is not obvious unless you know the system inside out.
Tthere are several ways to create a ROBLOX object in Lua:
local obj = Instance.new(‘type’); fill obj fields
local obj = Instance.new(‘type’, parent); fill obj fields
local obj = util.Create(‘type’, { field1 = value1, … })
If you care at all about performance, please only use the first option - I wi…
So instead of doing something like this.
local part = script.Parent
local bp = Instance.new("BodyPosition", part)
Do it like this.
local part = script.Parent
local bp = Instance.new("BodyPosition")
bp.Parent = part
The former is unopitimised and can often extend the operation time considerably.
Qinrir
(Quin)
November 29, 2021, 11:20am
#4
i see i will try it thank you for responding to my topic i dont get alot of replies haha
Qinrir
(Quin)
November 29, 2021, 11:32am
#5
it dosent work at all idk why but it dosent