I have a script that reduces the size of the player (HeadScale, BodyDepthScale, BodyWidthScale, and BodyHeightScale decreased), however, upon doing so, the player slides around (maybe accelerating/decelerating too slow), as if on ice.
I’m not exactly sure what in the script could cause this
The Code
local part = script.Parent
local touched = false
local resetTime = 2
part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
if not touched then
touched = true
Humanoid.HeadScale.Value *= .9
Humanoid.BodyDepthScale.Value *= .9
Humanoid.BodyWidthScale.Value *= .9
Humanoid.BodyHeightScale.Value *= .9
wait(resetTime)
touched = false
end
end
end)
I’m not even sure where I’d begin with looking for solutions myself, and I haven’t found any actual results on google, there’s been other forum posts but none that had actual answers.
This is Roblox’s fault I think. The way the humanoid walks is designed for the regular size, so decreasing it to be that small causes stuff like the slipping to happen
Probably the only way to change this is by increasing the friction of the parts in the character. You can do that by looping through every single part and changing the friction of it. Using an in pairs or in ipairs loop would be best for this.
Also there will be one part on the humanoid which controls it all, probably, but I dont know which one that is so all I can suggest is changing all of them
So I read about increasing friction, and thought up a possible solution. (After reading the docs for a solid half hour)
Basically just increasing friction and friction weight of the player by a bunch.
''Solution''
local descendants = Humanoid.Parent:GetDescendants()
---Gets descendants of the player's model.
for index, descendant in pairs(descendants) do
---Goes through every descendent of the player model.
if descendant:IsA("MeshPart") then
---Sets physProperties as the new physical properties.
local physProperties = PhysicalProperties.new(.7, 10, .5, 100, 1)
---Sets the physical properties as the physproperties for each MeshPart.
descendant.CustomPhysicalProperties = physProperties
end
end
Now I’m not marking this as a “solution” yet because, despite this seeming to fix it for me (At least mostly, you have to decrease walkspeed a bit), I’m not very experienced with scripting and there might be a better way.
Sorry about contributing to an old now dead post, but I wanted to say I found a potential fix for this. I don’t know if it’ll work for your application but it’s worth a shot:
In new versions of roblox studio ungroup a model and group it again and the error is fixed. This comes from the Scale property, that maybe the humanoid has it as an attribute for the acceleration, try that.