Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Safe zone help???

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.