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

What is wrong here? Tornado v6.0 dragger script

Asked by
JoLLDS 5
10 years ago

I need to do a wind limit, to where location maximum he can drag (not suck, dragging, suck comming soon), and only the positive X maximum is working, it's not dragging to his center the negative X position and Z position.

The maximum wind to drag is the maxd, accordding the fujita escale.

local force = script.Parent.Parent.Configuration:FindFirstChild("Fujita escale")
if force.Value == 0 then
    local wind = 4
else
    local wind = force.Value * 100
end
script.Parent.Mesh.Scale = Vector3.new((wind * 10) + 700,script.Parent.Mesh.Scale.Y, "-"..(wind * 10) + 700)
local maxd = wind / 2
local maxs = wind / 3
    contagemdesons =  wind / 10
local atual = 1
repeat
    local clone = script.Tornadowinds:clone()
    clone.Parent = script.Parent
    local atual = atual + 1
    wait()
until contagemdesons - 1 < atual
script.Tornadowinds:remove()
script.Parent.Sounds.Disabled = false
script.Parent.Spin.Disabled = false
local childlist = {}
local force = script.Parent.Parent.Configuration:FindFirstChild("Fujita escale")
if force.Value == 0 then
    local wind = 25
else
    local wind = force.Value * 100
end
local maxd = wind / 2
local maxs = wind /3
function addlist(child)
    if child.ClassName == "CornerWedgePart" or child.ClassName == "Flag" or child.ClassName == "FlagStand" or child.ClassName == "Part" or child.ClassName == "Seat" or child.ClassName == "SkateboardPlatform" or child.ClassName == "SpawnLocation" or child.ClassName == "TrussPart" or child.ClassName == "VehicleSeat" or child.ClassName == "WedgePart" then  
            childlist[#childlist + 1] = child
        end
end
function getAllChildren(place,table_) 
        for i,v in pairs(place:GetChildren()) do 
            table_[#table_ + 1] = v 
            getAllChildren(v, table_) 
        end 
    end 

    local children = {} 
    getAllChildren(game.Workspace, children) 


    for i = 1, #children do
        addlist(children[i])
    end
    game.Workspace.ChildAdded:connect(addlist)
    while true do
        for i = 1,#childlist do
            if (((childlist[i].Position.X < (script.Parent.Position.X + maxd) + 1) and (childlist[i].Position.X > (script.Parent.Position.X - maxd) - 1)) and ((childlist[i].Position.Z < (script.Parent.Position.Z + maxd) + 1) and (childlist[i].Position.Z > ((script.Parent.Position.Z - maxd)) - 1))) and (script.Parent.Position.Y - (script.Parent.Size.Y / 2) < childlist[i].Position.Y and script.Parent.Position.Y + (script.Parent.Size.Y / 2) > childlist[i].Position.Y) then        --Here is the limit detector, Z and X negative is not working  
                if childlist[i]:FindFirstChild("dragged") == nil then   
                        local peso = Instance.new("NumberValue")
                        peso.Parent = childlist[i]
                        peso.Name = "peso"
                        local peso = peso.Value
                        if childlist[i].Material == Enum.Material.Brick then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 43
                        end
                        if childlist[i].Material == Enum.Material.Concrete then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 50
                        end
                        if childlist[i].Material == Enum.Material.CorrodedMetal then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 18
                        end
                        if childlist[i].Material == Enum.Material.DiamondPlate then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 15
                        end
                        if childlist[i].Material == Enum.Material.Fabric then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 18
                        end
                        if childlist[i].Material == Enum.Material.Foil then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 24
                        end
                        if childlist[i].Material == Enum.Material.Granite then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 3
                        end
                        if childlist[i].Material == Enum.Material.Grass then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 7
                        end
                        if childlist[i].Material == Enum.Material.Ice then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 24
                        end
                        if childlist[i].Material == Enum.Material.Marble then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 9
                        end
                        if childlist[i].Material == Enum.Material.Pebble then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 5
                        end
                        if childlist[i].Material == Enum.Material.Plastic then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 2
                        end
                        if childlist[i].Material == Enum.Material.Sand then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 5
                        end
                        if childlist[i].Material == Enum.Material.Slate then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 24
                        end
                        if childlist[i].Material == Enum.Material.SmoothPlastic then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z)
                        end
                        if childlist[i].Material == Enum.Material.Wood then
                            peso = (childlist[i].Size.X + childlist[i].Size.Y + childlist[i].Size.Z) * 3
                        end
                        if wind - (((((script.Parent.Position.X + script.Parent.Position.Z) / 2)) - maxd)) > peso  or human ~= nil then
                                                            local human = childlist[i].Parent:FindFirstChild("Head")    
                local dragger = Instance.new("BodyPosition")
                dragger.Name = "dragged"
                dragger.position = Vector3.new(script.Parent.Position)
                dragger.maxForce = Vector3.new(wind * 100, 0, wind * 100)
                dragger.Parent = childlist[i]
                --if peso < wind - ((childlist[i].Position.X - childlist[i].Position.Z) - (script.Parent.Position.X + script.Parent.Position.Z)) then -- i put in it for disable for some time
                    local seat = childlist[i].Parent:GetChildren()
                    local tem = childlist[i].Parent:FindFirstChild("VehicleSeat")
                    if human == nil and tem == nil then
                        childlist[i]:BreakJoints()
                    end
                    --end
                end
            end
            end
            end
        wait() -- i can only put wait() here, putting one end up will do the tornado suck 1 per time, and will be bad... :P
    end

0
Don't need anymore, i discovered the error, the maxd was not big on sufficient JoLLDS 5 — 10y

Answer this question