Hello! I am trying to get an unanchored part to interact better with the tools the players use to hit and control the part. The unanchored part I am talking about is a small black cylinder like a hockey puck. The tool used is a “MeshPart” with the appearance of a hockey stick. The puck is the only unanchored part in the entire game (other than the players and tools.)
Currently, issues can occur in the gameplay where the puck will go right through the stick. This occurs when the puck is sleeping. Sometimes the puck is too slow to become awake; hence, the puck doesn’t respond in time, leaving the stick to go right through the puck. When this happens it can take a few hits at the puck to get it to interact again.
Here is an example of what I am talking about…
With about 15 seconds left in this video you can see it happen with “Awake Parts” visualization on.
Last year I implemented ownership into the game. I added a script into the puck that can detect the player who has their stick closest to the puck, and is within a magnitude of 10. I don’t think my ownership script is causing issues considering this was already happening before I coded the script.
Here is the code I used…
local nearestPlayer = nil local dist = math.huge function FindNearestPlayer() for i,v in pairs(game.Players:GetPlayers()) do if v.Character then local hockeystick = v.Character:FindFirstChild("2020 Hockey Stick") if hockeystick ~= nil then hockeystick.Blade.Color = Color3.fromRGB(198,157,99) local magnitude = (hockeystick.Blade.Position - script.Parent.Position).Magnitude if magnitude < 10 and script.Parent.Anchored == false then if magnitude < dist then dist = magnitude nearestPlayer = v.Name script.Parent:SetNetworkOwner(v) hockeystick.Blade.Color = Color3.fromRGB(0,255,0) end end end end end end while true do wait (0.1) FindNearestPlayer() end
Other things I have tried that failed:
- Experimenting with the density of the puck and hockey stick.
- Experimenting with the other “CustomPhysicalProperties” of the puck and hockey stick.
- Changing the magnitude in the script from distances that are closer or further distances.
- Changing the while true do wait times from quicker or longer waits.
- Disabling the script.
- Messing with the Legacy body movers in the puck.
- Changing the Legacy body movers to the new constraint ones.
- Using a regular part instead of a cylinder.
What I noticed was that the better your internet connection was, the quicker the part wakes up. The issue still could occur with 3 bars of internet, but the issue was less frequent than with 2.
I looked at other forum posts. There was a bunch of them that talked about sleeping part issues. The recommendation in those posts seemed to be to give the sleeping part a slight push using force. Yet, when I tested with this you need to give the puck a large push to keep it awake. This is unrealistic for a ice hockey experience. There can’t be mysterious movements that makes the puck look like it has a mind of its own. Everything else seemed to be about the best ways to handle projectiles or driving vehicles. Didn’t really help much with advice in regards to collisions with a single unanchored part.
It would be nice if anybody could offer any advice to help me out. It isn’t the biggest deal in the world if this issue doesn’t get resolved soon. It’s only a minor problem when you consider in a full server scenario the puck is going to be moving a ton anyways. I am just trying to bring the game experience to the next level, and make the game more inclusive for players who might have a weaker internet and/or a lower end digital device. If there is any way to fix my current script, like putting code, or adding a new script to help with sleeping parts; just let me know. Thank you for reading!