How do i fix this error

Whenever i try to play my game in roblox studio it closes immediately


without a crash message? what do i do? ( it lets me play test my other games but not this one)

1 Like

If it is allowing you to playtest your other games, maybe you have a faulty script within this game preventing you from playtesting?

1 Like

I think you were right because when I disabled this script

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")
		while true do
			wait(1)
			if humanoid.WalkSpeed > 20 then
				plr.Character.Animate.fall.FallAnim.AnimationId = "http://www.roblox.com/asset/?id=13503096709"
				print("Player Started Running")
			else
				plr.Character.Animate.fall.FallAnim.AnimationId = "http://www.roblox.com/asset/?id=13502938748"
				print("Player Stopped Running")

			end
		end

	end)
end)

the game started running again

but I had this script in the game earlier and it ran fine so I don’t know how it caused the game to crash

1 Like

Yes that does seem like the script causing the problem.

Do you really need this script?

From looking at the script you have provided, you are checking if the player is moving or not and please correct me if I’m wrong. If this is what you are trying to achieve, this is an improved version of your code that shouldn’t cause any errors.

Client-script (LocalScript):

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local function IsPlayerMoving()
    if Humanoid.MoveDirection.Magnitude > 0 then
        print("Is moving")
    else
        print("Not moving")
    end
end

RunService.RenderStepped:Connect(IsPlayerMoving)
1 Like

No it isn’t, I was trying to make a script where if your going a certain speed your fall animation changes and if you go below that speed it changes back

1 Like