Hello. I’m having trouble with detecting if a player’s in a vent. I want them to not be able to stop crawling when they’re touching the vent floor. Here is my the script inside the vent floor:
local replicated = game:GetService("ReplicatedStorage")
local vfl = replicated:WaitForChild("Ventfloorlol")
vfl.OnServerEvent:Connect(function(Player,...)
print(Player.Name)
print(...)
end)
wait(4)
function enter(player)
wait(2)
local plr = game.Workspace:FindFirstChild(player.Name)
if plr then
local char = plr
vfl:FireClient(player)
end
end
game.Players.ChildAdded:connect(enter)
And here is the C to Crawl Script:
local replicated = game:GetService("ReplicatedStorage")
local vfl = replicated:WaitForChild("Ventfloorlol")
local vent = false
vfl.OnClientEvent:Connect(function(...)
vent = true
print("VENT")
end)
local userinputservice = game:GetService("UserInputService")
local character = script.Parent
local ventfloor = workspace.Rooms.VentRoom1.Build.Slow
local humanoid = character:WaitForChild("Humanoid")
local isrunning = false
local anim = humanoid:LoadAnimation(script:WaitForChild("Animation"))
userinputservice.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C or key.KeyCode == Enum.KeyCode.LeftControl then
if vent == false then
if not isrunning then
isrunning = true
humanoid.WalkSpeed = 8
anim:Play()
else
humanoid.WalkSpeed = 16
anim:Stop()
isrunning = false
end
end
end
end)
Any idea on what’s going wrong? Thanks in advance to anyone with the solution 