i just discovered the gui collision service in roblox about a month ago and im still baffled by this script there is NO problems its just adding the player as a hitter and then the collision frame as a collider heres the local script
the game lags after a couple of minutes of playing for some reason
when i disable the script the game dosent lag but this script is fundemental for the game because its a boarder system that keeps the player from leaving the area
local GuiCollisionService = require(game:GetService("ReplicatedStorage").COLLISION_SERVICE.GuiCollisionService)
local GR = GuiCollisionService.createCollisionGroup()
local t = game:GetService("TweenService"):Create(script.Parent.Player, TweenInfo.new(1, Enum.EasingStyle.Linear), {Position = UDim2.new(0.431, 0,0.858, 0)})
GR:addHitter(script.Parent.Player, { t })
GR:addCollider(script.Parent.RightBoarder, true)
GR:addCollider(script.Parent.LeftBoarder, true)
If this script lag too much and you need the player to stay inside an area, why not using another methode? Like workspace:GetPartsInPart or event the distance between the center and the player position with magnitude
Perhaps too many elements are being created, or the last action did not have time to end and a new one started, you should make sure that there is no such thing in your modular script, and if there is a fix or replace, for example, when a new action starts, extinguish the old one to compensate for changes in performance. Also, try to run the game on a real server, and not through Roblox Studio and check if this error will happen again.
ok after a long time REALLLY LONG TIME like 3 weeks of trying to find this stupid solution , simply there isn’t, what’s happening is that the game just lags from the collision service itself, the script is absloutly fine with no problems,
so how did i find the solution? simple, i just disabled the script and then realized that the game stopped lagging that’s how i knew that was the issue, and when i’m in mid game and the game is lagging at that specific time when i disable the script the game stops lagging and then when i reenable it it lags back in a few minutes
so what i simply did is made a script that disables that script every 10 seconds and then enable it right away , and so far the lag is not there anymore. i hate that Roblox dosen’t even have a gui collision service in the first place but whatever, sorry if this is long
if this dosen’t work im gonna completly ignore the lag and let the game be