Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I fix this ModuleScript?

Asked by
Zerio920 285 Moderation Voter
9 years ago

It's a little lengthy, but bear with me. I have this script in a brick:

local Library3 = require(Workspace.Start)
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
Library3.start(script.Parent.Parent.Parent)
end
end)

I have this in a ModuleScript:

local Library3={}

function Library3.start(item)
    function scan(item)
if item:FindFirstChild("Rotor") then
    item.Rotor.BottomParamA = -0.20
    item.Rotor.BottomParamB = 0.20
elseif item:FindFirstChild("Alert") then
    item.Alert.Sound4:Play()
    item.Alert.BrickColor = BrickColor.new(1020)
    item.Alert.Transparency = 0
end
if #item:GetChildren() > 0 then
for _,v in pairs(item:GetChildren()) do
scan(v)
end
end
end

end

return Library3

When a player touches the brick, it's supposed to call the module script, which is then supposed to scan all the bricks in the model to find "Alert" and "Rotor" and make the necessary changes to their properties. Touching the brick produces no effect however. Anything I'm doing wrong here?

Answer this question