If player is standing a certain script enables, if a player walks then script disables

but where do i put it? (im bad at knowing where to put stuff)

Can you explain more what do you want to achieve, else here a code to know if a player is standing, place it in a local script in StarterCharacterScript :

local Script = --YOURSCRIPT--
while wait() do
    if Vector3.new(0, 0, 0) then
        Script.Enabled = false
    end
end

I hope that was helpful have a nice day !

3 Likes

but i need to enable it when a player starts walking

You can use the Humanoid.Running event, like so:

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local human = char:WaitForChild("Humanoid") --wait for the humanoid instance to start existing
		
		human.Running:Connect(function(speed) --fires every time the player's speed changes
			if speed > .75 then
				print("walking")
			else
				print("standing")
			end
		end)
	end)
end)

You should tell us more what you actually want to do, there’s probably a better way than toggling a script

1 Like

it didnt work, i placed it in startercharacterscripts

i want to disable walk anim from the footplant system: R6 IKPF (Inverse Kinematics Procedural Footplanting) the script uses c frames to animate

Do this :

local Script = --YOURSCRIPT--
while wait() do
    if Vector3.new(0, 0, 0) then
        Script.Enabled = false
    else
        Script.Enabled = true
    end
end

it didnt work i tried a local script, script, i placed it in startercharacterscripts and here is the code:
local Script = game.StarterPlayer.StarterPlayerScripts.R6ProceduralAnimations
while wait() do
if Vector3.new(0, 0, 0) then
Script.Enabled = false
else
Script.Enabled = true
end
end

1 Like

Do this :

local Player = game:GetService("Players").LocalPlayer
local Script = Player.Character.R6ProceduralAnimations

while wait() do
	if Vector3.new(0, 0, 0) then
		Script.Enabled = false
	else
		Script.Enabled = true
	end
end

dosent work, i made a mistake in title i meant a script disables when a player moves, here is what i did
local Player = game:GetService(“Players”).LocalPlayer
local Script = Player.Character.R6ProceduralAnimations

while wait() do
if Vector3.new(0, 0, 0) then
Script.Enabled = true
else
Script.Enabled = false
end
end

Pretty sure you cant “enable” a script because that doesnt exist.

local Player = game:GetService(“Players”).LocalPlayer
local Script = Player.Character.R6ProceduralAnimations

local RunService = game:GetService("RunService") -- Heartbeat is more reliable than using wait()

runService.Heartbeat:Connect(function()
	if Vector3.new(0, 0, 0) then
		Script.Disabled = false
	else
		Script.Disabled = true
	end
end)

https://streamable.com/58csxw
idk if its related to the script u gave me but the legs are now broken, i dont think it enables it when im idle here is what i did:
local Player = game:GetService(“Players”).LocalPlayer
local Script = Player.Character.R6ProceduralAnimations

local RunService = game:GetService(“RunService”) – Heartbeat is more reliable than using wait()

runService.Heartbeat:Connect(function()
if Vector3.new(0, 0, 0) then
Script.Disabled = true
else
Script.Disabled = false
end
end)

turns out the legs thing wasnt ur script’s fault its just that something was wrong with my game, i made a new game and ur script did not work

i managed to come up with this:
local PS = game:GetService(“Players”)

local player = PS.LocalPlayer

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

local Humanoid = char:WaitForChild(“Humanoid”)

Humanoid:GetPropertyChangedSignal(“MoveDirection”):Connect(function()

print(Humanoid.MoveDirection.Magnitude)

script.Animate.Disabled = true

end)

Humanoid.Running:Connect(function(Speed)

if Speed > 0.75 then

script.Animate.Disabled = true

else

script.Animate.Disabled = false

end

end)

it works but it stops working once the foot is planting on something here is the footage:

Wait… did you want the script to disable when walking so it wouldnt mess up the walking animation…?
if you did, why didnt you just delete the part of the script that causes it to work when walking lol

thats not how ik works, i also copy pasted and realized its not possible to remove the animation

:face_with_raised_eyebrow:

wat

This is pretty obvious. Its because youre disabling the script while the ik is still active. It uses CFrames, no? this means it wont reset when the script is disabled. Ive got 2 options for you.

Make a script that reverts the CFrames back to normal

or

Make the script again / if you got it online, make the script yourself so you can understand the script and change certain things.