I have a local script. It accelerates you when you climb onto the part, and gives you the usual speed when you climb down the part. The local script is located in "StarterGui -> Move". I need this script to be able to select all parts in the folder or in the model, along the path "Workspace -> Roads". How can this be done?
local plr = game:GetService("Players").LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local humanoid = chr:WaitForChild("Humanoid")
local part = game.Workspace:WaitForChild("Part") --here
local minX = part.Position.X - part.Size.X/2
local maxX = part.Position.X + part.Size.X/2
local minZ = part.Position.Z - part.Size.Z/2
local maxZ = part.Position.Z + part.Size.Z/2
local positionOne = Vector3.new(minX, part.Position.Y + part.Size.Y/2, minZ)
local positionTwo = Vector3.new(maxX, (part.Position.Y + part.Size.Y/2) + 4, maxZ)
local region = Region3.new(positionOne, positionTwo)
game:GetService("RunService").RenderStepped:Connect(function()
local parts = game.Workspace:FindPartsInRegion3(region, nil, 1000)
local found = false
for i, v in pairs(parts) do
if v.Parent == chr then
found = true
end
end
if found then
humanoid.WalkSpeed = 60
else
humanoid.WalkSpeed = 16
end
end)
Thank in advance.
