Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Way to stop roblox running scripts from working in my crawl and sliding script?

Hello I once again have a problem in my game but this time it is partly the script and probably a priority in my roblox animation which i predict. So what is basically happening is when im using my crawl and slide script it will also use roblox running script. Is there a way to stop this? (im predicting i have to change the animation priority) Here is the video sorry if it looks like a nintendo ds recording i had to lower my obs settings and here is the script.

local id = "rbxassetid://6169678056"
local anim = Instance.new("Animation")
local animation
local slidingid = "rbxassetid://6169761361"
local slidinganim = Instance.new("Animation")
local slidinganimation
anim.AnimationId = id
slidinganim.AnimationId = slidingid
local cas = game:GetService("ContextActionService")
local function crawl(actionname, inputstate, inputobject)
	if actionname == "Crawl" then
		if inputstate == Enum.UserInputState.Begin then
			local player = game.Players.LocalPlayer
			animation = player.Character.Humanoid:FindFirstChild("Animator"):LoadAnimation(anim)
			animation:Play()
		else
			animation:Stop()
			animation:Destroy()
		end
	end
end
local function sliding(actionname,inputstate,inputobject)
	if actionname == "Slide" then
		if inputstate == Enum.UserInputState.Begin then
			local player = game.Players.LocalPlayer
			slidinganimation = player.Character.Humanoid:FindFirstChild("Animator"):LoadAnimation(slidinganim)
			slidinganimation:Play()
		else
			slidinganimation:Stop()
			slidinganimation:Destroy()
		end
	end
end
cas:BindAction("Crawl",crawl,true,Enum.KeyCode.C,Enum.KeyCode.LeftControl,Enum.KeyCode.ButtonR1)
cas:BindAction("Slide",sliding,true,Enum.KeyCode.LeftShift,Enum.KeyCode.S,Enum.KeyCode.ButtonL1)

This is a local script by the way.

2 comments

0

Have you changed the Action Priority of the animation itself? Animations with a higher priority will override those with lower, so I think your animations are running at a lower priority than the running animation. All default roblox animations run at "Core". https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/Priority

0

Its at the highest priority (action) Because i saw somebody having trouble with a crawling script and then changing it to Action worked for them.

1 answer

then you need to write end in the end of your script, like this:

local id = "rbxassetid://6169678056"
	local anim = Instance.new("Animation")
	local animation
	local slidingid = "rbxassetid://6169761361"
	local slidinganim = Instance.new("Animation")
	local slidinganimation
	anim.AnimationId = id
	slidinganim.AnimationId = slidingid
	local cas = game:GetService("ContextActionService")
	local function crawl(actionname, inputstate, inputobject)
	    if actionname == "Crawl" then
	        if inputstate == Enum.UserInputState.Begin then
	            local player = game.Players.LocalPlayer
	            animation = player.Character.Humanoid:FindFirstChild("Animator"):LoadAnimation(anim)
	            animation:Play()
	        else
	            animation:Stop()
	            animation:Destroy()
	        end
	    end
	end
	local function sliding(actionname,inputstate,inputobject)
	    if actionname == "Slide" then
	        if inputstate == Enum.UserInputState.Begin then
	            local player = game.Players.LocalPlayer
	            slidinganimation = player.Character.Humanoid:FindFirstChild("Animator"):LoadAnimation(slidinganim)
	            slidinganimation:Play()
	        else
	            slidinganimation:Stop()
	            slidinganimation:Destroy()
	        end
	    end
	end
	cas:BindAction("Crawl",crawl,true,Enum.KeyCode.C,Enum.KeyCode.LeftControl,Enum.KeyCode.ButtonR1)
	cas:BindAction("Slide",sliding,true,Enum.KeyCode.LeftShift,Enum.KeyCode.S,Enum.KeyC
end

or am I missing sonething?

1 comment

0

yea you are, expected eof got end

This discussion is preserved as it was. New answers, comments, and votes are closed.