#Deny running

26 messages · Page 1 of 1 (latest)

rigid stratus
#

So I have a script that makes the player run when they press Shift

#

And if the player runs while the animation is playing, their WalkSpeed and JumpPower will be set back to normal

#

Is there any way to make the player not able to run while the animation is playing?

little hamlet
#

No clue where the shift-to-run part is, but simply check the animation status when the player presses shift.

rigid stratus
#

Um

#

It's in another script in StarterCharacterScript

#

Gimme a sec

little hamlet
#

In any case we're talking about a local script. Gotta be careful w/ it.

rigid stratus
#

um

#

My friend literally copied this from a youtuber and just pasted it into our game

little hamlet
#

Hell naw.

#

Anyways, this is the part you gott aconsider.

#

Also, no clue why there are 2 shift detecting blocks of code.

rigid stratus
#
cas:BindAction("Sprint", handleContext, true, Leftc, RightC)
little hamlet
#

Ain't no way the dog is using 2 chunks for simply activating/de-activating a run.

rigid stratus
#

idk

#

I didn't even interact with this script until today

#

Cuz like I said, my friend was the one who pasted this script

little hamlet
#
local fov = 70;
local running = false;
UIS.InputBegan:Connect(function(key, gameProcessed)
    if gameProcessed then return end
        running = not running
    if key.KeyCode == Enum.KeyCode.LeftShift then
        if CameraEffect == true then
                        if running then fov = 90 else fov =  70 end;
            TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = fov}):Play()
        end
                if running then Humanoid.WalkSpeed = SprintSpeed else Humanoid.WalkSpeed = NormalWalkSpeed end;
    end
end)
#

Something more like this, to compress those 2 chunks.

rigid stratus
#

That's not really the problem thoo

rigid stratus
#

So uhh

#
local CutsceneFolder = game.Workspace.NeutralizerCutscene
local detector = CutsceneFolder:WaitForChild("TouchTrigger")
local tube = CutsceneFolder.Blue
local tpTo = CutsceneFolder:WaitForChild("TPto")

local runScript = game.StarterPlayer.StarterCharacterScripts.RunScript

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local humanoid = char:WaitForChild("Humanoid")
local humRootPart = char:WaitForChild("HumanoidRootPart")
local playerAnimation = humanoid:LoadAnimation(game.ReplicatedStorage.Animations.NeutralizerTouched_Player)

local animationPlayed = game.Workspace.LeverCutscene:WaitForChild("AnimationPlayed")

detector.Touched:Connect(function()
    if animationPlayed.Value == true then
        animationPlayed.Value = false
        
        humRootPart.CFrame = tpTo.CFrame
        
        game.ReplicatedStorage.Remotes.NeutralizerCutscene:FireServer("NeutralizerTouched")
        
        humanoid.WalkSpeed = 0
        humanoid.JumpPower = 0
        playerAnimation:Play()
        
        runScript.Enabled = false
        
        task.delay(3.5, function()
            humanoid.WalkSpeed = 16
            humanoid.JumpPower = 50
            runScript.Enabled = true
        end)
    end
end)