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

Safe zone help???

Asked by 10 years ago

Im makng a game where if you are on a brick then you have an ff and if you are off the block then you lose your ff but the problem is the ff does not go away can someone fix my scripts please?

scrpt 1:

function onTouched(part)

    local h = part.Parent:findFirstChild("Humanoid")

    if h~=nil then
        if (h.Parent:FindFirstChild("AreaShield") == nil) then
            local a = script.AreaShield:clone()
            a.Disabled = false
            a.Parent = h.Parent
        end
    end


end



script.Parent.Touched:connect(onTouched)

script 2:

f = Instance.new("ForceField")
f.Parent = script.Parent

while true do
    wait(.5)
    if (script.Parent:FindFirstChild("Torso") ~= nil) then
        if ((script.Parent.Torso.Position - game.Workspace.SafePlate.Position).magnitude > 64) then break end
    else
        break
    end

end

f.Parent = nil
script.Parent = nil



1 answer

Log in to vote
0
Answered by 10 years ago

Script 1: (I hope I did these right)

script.Parent.Touched:connect(function(hit)
    if hit.Parent.Character then
        if hit.Parent.Character:FindFirstChild("Humanoid") ~= nil then
            if not hit.Parent:FindFirstChild("AreaShield") then
                local a = script.AreaShield:Clone()
                a.Disabled = false
                a.Parent = hit.Parent.Character -- forcefields go in the character model
            end
        end
    end
end)

I don't know about the second script, but this should work for the first.

Ad

Answer this question