I need help with instancing

Whatsup scripters,

I wanted to make a forcefield part that would just give you a forcefield once you touch the part, which is pretty self-explanatory, but I stumbled onto a bug that puts the forcefield in the middle of the map instead of in the torso. I told the script to parent the forcefield in the torso, but it appears to bug.

Could anyone help?
Thanks in advance.

local forcefield = Instance.new("ForceField")
local debounce = false

if debounce == false then
	debounce = true
	script.Parent.Touched:Connect(function(hit)
		
		if game.Players:GetPlayerFromCharacter(hit.Parent) then
			if not hit.Parent.Torso:FindFirstChild("forcefield") then
				script.Parent.Highlight.Enabled = true
				forcefield.Parent = hit.Parent:FindFirstChild("Torso")
			end
		end
		
		
		task.wait(5)
		debounce = false
	end)
end

It needs to be parented to the character. and also rather use Region3 than touched.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.