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

How do I make force fields last infinite?

I'm trying to make a game with anti team kill but the only way to do that is to use force fields, the force fields do not last forever even though I made the forcefield time on the spawn infinite. Any help would be amazing.

1 answer

✓ Accepted answer

If you want to give a player an indefinitely lasting force field, you have to insert a new force field into their character.

The code below gives the player an infinite force field every time their character spawns.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local field = Instance.new("ForceField")
		field.Parent = char
	end)
end)

Although, force fields aren't the only way to avoid team-killing. You can have the weapons check for the holder's team, and the team of player who gets hit, and determine whether or not the player should take damage.


Good luck with your further development! :D

~Sethex, aka. TheWaterFoox

2 comments

0

Damn thanks so much, I will try this now! :)

0

This helped so much, works perfectly. This is very important to my game I cant thank you enough!

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