Recently when I created a new script, I get this error:
(you can see explorer shows its there)
code1:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(script:WaitForChild("CA"))
local iscrawlingv = Instance.new("BoolValue")
iscrawlingv.Name = ("iscrawling")
iscrawlingv.Parent = player
local iscrawling = character:WaitForChild("iscrawling")
humanoid.HealthChanged:Connect(function(health)
if health <= 15 then
iscrawling.Value = true
humanoid.WalkSpeed = 3
anim:Play()
elseif health > 15 then
iscrawling.Value = false
humanoid.WalkSpeed = 16
anim:Stop()
end
end)
code2:
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local distanceMin
local distance
local closestPlayer
UserInputService.InputBegan:Connect(function (input, IsTyping)
if input.KeyCode == Enum.KeyCode.E and IsTyping == false then
distanceMin = math.huge
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer then
local iscrawling = player:WaitForChild("iscrawling")
if iscrawling.Value == true then
distance = player:DistanceFromCharacter(head.Position)
if distance < distanceMin then
distanceMin = distance
closestPlayer = player
end
end
end
end
if distanceMin < 10 then
print(closestPlayer.Name .. " is the closest player.")
end
end
end)