local SpecialParts = game.Workspace.SpecialParts
for i, part in pairs(SpecialParts:GetChildren()) do
local db = false
local Speed = part:GetAttribute("WalkSpeed")
if part.Name == "Speedbrick" then
part.Touched:Connect(function(Hit)
if not db then
db = true
local Humanoid = Hit.Parent:findFirstChild("Humanoid")
Humanoid.WalkSpeed += Speed
task.wait(0.1)
db = false
end
end)
end
end
I’m pretty sure the script isn’t checking if the hit is a character or some random part. In order to do this, you have to add an if statement.
local SpecialParts = game.Workspace.SpecialParts
for i, part in pairs(SpecialParts:GetChildren()) do
local db = false
local Speed = part:GetAttribute("WalkSpeed")
if part.Name == "Speedbrick" then
part.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(Hit.Parent) then
if not db then
db = true
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
Humanoid.WalkSpeed += Speed
task.wait(0.1)
db = false
end
end
end)
end
end