Follow up from my old thread, I want to know how would I change the player’s character’s friction for future use.
I once set it up and it works fine but after I kept developing it, it somehow stopped working? I think i accidentally removed some part of it perhaps?
Here’s the script
local function setfriction(character)
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
if not part.CustomPhysicalProperties then
part.CustomPhysicalProperties = PhysicalProperties.new(part.Material)
end
local orig = part.CustomPhysicalProperties
local density = 1
local friction = GameBaseStats.BaseFriction
local elasticity = 0.5
local frictionWeight = 1
local elasticityWeight = 1
part.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
end
end
end
When you test the place do your character’s Parts Friction values = GameBaseStats.BaseFriction?
What is all this supposed to do:
if not part.CustomPhysicalProperties then
part.CustomPhysicalProperties = PhysicalProperties.new(part.Material)
end
local orig = part.CustomPhysicalProperties
How is GameBaseStats.BaseFriction set? Try putting in local friction = 0 instead. If the Friction sets to 0 then you know you have a problem with the variable.
Hey, I used this script and called it when a character is loaded, and it works as intended.
local function setfriction(character)
local density = 1
local friction = 0.2
local elasticity = 0.5
local frictionWeight = 1
local elasticityWeight = 1
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
if not part.CustomPhysicalProperties then
print("not found for"..tostring(part))
part.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
end
--local orig = part.CustomPhysicalProperties
--part.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
end
end
end
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
setfriction(char)
end)
end)
Ok… so i tried changing the density and it works now???
Still not the results that I want though.
(I want my players to starts off slow and ends with player slowly sliding (kind of like source game but with starting inertia) to prevent ADADADAD spamming)