Player isn't turning into slippery ice

I’ve been trying to turn the player into slippery ice by pressing a button. For some reason everything I try doesn’t work. My final attempt at making this used a leaderstat for parts of the script (you’ll see once you read the script. Do you guys have any ideas?

leaderstat script (in server script service):

game.Players.PlayerAdded:Connect(function(plr)

	local ls = Instance.new("Folder",plr)
	ls.Name = "IceCheck"

local ice = Instance.new("BoolValue",ls)
	ice.Name = "IceOn"
	ice.Value = false
end)

ice button script (starter character scripts)

local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Debounce = true
local mouseDown = false



-- ANimation---

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")





local animInstance = Instance.new("Animation")

animInstance.AnimationId = "rbxassetid://6715952610" -- Animation

local SlashAnim = humanoid:LoadAnimation(animInstance)  -- SlashAnim You Can Change Name



--Sound--



local Player = Game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")

local db = false
local Tapped = false
UserInputService.InputBegan:Connect(function(Input, GameStuff)
	if GameStuff then return end
	if Input.KeyCode == Enum.KeyCode.F or Input.KeyCode == Enum.KeyCode.ButtonL1 then


	if Debounce == true then
    Debounce = false
			
		--Animation--
			
		SlashAnim:Play() -- Animation Work
			
			
		----------
			
			game.Players.LocalPlayer.IceCheck.IceOn.Value = true	
		wait(.2) -- Cooldown
		Debounce = true

			
		Debounce = true
			end
	end
end)

Ice enabler script (starter character scripts)

local ice = game.Players.LocalPlayer.IceCheck.IceOn.Value
Char = script.Parent
local leg = script.Parent.RightLeg

ice:GetPropertyChangedSignal("Value"):connect(function()
	
	if game.Players.LocalPlayer.IceCheck.IceOn.Value == true then
		leg.CustomPhysicalProperties = true
		leg.CustomPhysicalProperties.Friction = 0
		leg.CustomPhysicalProperties.FrictionWeight = 100
		leg.CustomPhysicalProperties.Density = 100
		leg.CustomPhysicalProperties.Elasticity = 1
	elseif game.Players.LocalPlayer.IceCheck.IceOn.Value == false then
	
	end
end)

	

While I don’t have much for ideas, I know that if you stun yourself, this does actually make you slide like you are on ice (but only while stunned)

what do you mean stun yourself? Do you mean sitting? That would be a good idea, but I have a bunch of scripts in the game I’m trying to put this in. One of those scripts makes it so that you can’t really sit down. I’ve tried turning my characters leg into ice while playtesting in studio and it works. I just need to turn their leg into ice through a script

No, I mean setting humanoid’s state to “physics”, but know that they can no longer do inputs while in this states

1 Like

that’s something I haven’t tried yet. Let me do it real quick!

1 Like

Suggestion:
Did you make sure every other part is either weightless or massless except for the HumanoidRootPart?

Why not the HumanoidRootPart?
Because the character moves differently according the HumanoidRootPart’s mass.

In short, don’t mess with the arms and legs but with the HumanoidRootPart. Hope this helps.

I’ve already turned the characters leg into ice in studio. I just gotta do it through a script

So you’re saying you need a script that can make your character turn into ice when they click a button…? That’s very easy coding I thought you got that set up already.

I do… The problem is that it doesn’t work for some reason

Easy fix, except you’re going to need a new set of codes, since I am bored I can write one for you.

Make this a local script inside the button:


local humanoidrootpart = game.Players.LocalPlayer.Character.HumanoidRootPart

script.Parent.MouseButton1Click:Connect(function(player)
if humanoidrootpart.Material == Enum.Material.Plastic then
humanoidrootpart.Material = Enum.Material.Ice
elseif humanoidrootpart.Material == Enum.Material.Ice then
humanoidrootpart.Material = Enum.Material.Plastic
end
end)


Hope this helps, You can obv change it and add stuff.

what I meant by “changing it into ice” was making slippery like ice, not changing material, but I’ll edit this and see if it works

apparently I didn’t know how to use custom physical properties. The entire problem was that I didn’t know how to use custom physical properties in scripts, so I did a quick search and got my problem solved. If you stumble upon this post, here is the solution: BasePart | Roblox Creator Documentation

1 Like