I’m being serious when I say this has basically no pattern. I’ll call :PivotTo()
on a PVInstance
and it’ll work 80 times and fail 20 times. This happens across all scripts, on certain PVInstances
with seemingly no visible pattern. It happens only to a small selection of models in my game
What causes this to happen? How can I fix it?
local function pivotset(model: Instance)
local func = coroutine.create(function()
print("pivotting "..model.Name)
if not model:IsA("PVInstance") then return end
if model == lassohead then
lassohead.rope.WinchForce = 0
task.wait()
stopvelocity(lassohead)
for i, section in model:GetChildren() do
if not section:IsA("PVInstance") then continue end
section:PivotTo(gettoolpivot())
end
lassohead.rope.WinchForce = headwinchforce
return
end
stopvelocity(model)
model:PivotTo(gettoolpivot())
end)
coroutine.resume(func)
end
Please provide the script that contains the function
I’ve edited the post to add the code, though I’m actually planning on making a bug report because I’ve analyzed code in every script this is happening and I don’t see anything wrong with it
I made this post to see if others have encountered it and found workarounds. But if you see a problem, let me know
why would you need coroutines for that? try doing all that without coroutines and, since pivot to is based on pivots maybe the pivots are messed up? can you describe what your code does im very confused what is it supposed to do
It’s pretty old code. I wrote amateurishly, but it was doing the bug before I added coroutines into the mix. Like, the weird behavior happens with this different code where I directly pivot an object as well:
for i, boat in boatmarkers:GetChildren() do
local startingcframe = boat:GetPivot()
local class = "boat"
local newtransport = defaultboat:Clone()
if boat:FindFirstChild("class") then class = boat.class.Value end
newtransport.class.Value = class
local huskseat = boat:FindFirstChildOfClass("VehicleSeat")
local body = boat:FindFirstChild("body")
if not huskseat or not body then continue end
local partobj = body:FindFirstChild("colorpart")
if not partobj then continue end
local bodypart = partobj.Value
local seatweld = Instance.new("WeldConstraint")
seatweld.Parent = newtransport.bodybase
seatweld.Part0 = newtransport.bodybase
local newseatpos = newtransport.Driver:GetPivot()
boat:PivotTo(newseatpos)
end
That last line always messes up on some of the boats in Studio, whereas in Roblox it used to not very often. A few days ago however, it started not working on certain boats a lot
1 Like
maybe the pivots are messed up?
Have you made any bug report i also got a similar problem were when i use PivotTo on a model the parts inside just goes vecotr3 0,-billions,0