How would I make my local script work for a normal?

what I mean in the title is how would I make this script into a normal instead of local script?

Local Script:

local Folder = workspace.Infectors -- Change to your folder 
local Animation = game.Workspace.Animation
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

for Index, Part in pairs(Folder:GetChildren()) do
	Part.Touched:Connect(function(touched)
		if touched.Parent:FindFirstChild("Humanoid") then
			local AnimPlay = touched.Parent.Humanoid:LoadAnimation(Animation)
			touched.Parent.HumanoidRootPart.Anchored = true
			AnimPlay:Play()
			AnimPlay.Stopped:wait() --Waits until it finished playing
			touched.Parent.HumanoidRootPart.Anchored = false
			player.TeamColor = BrickColor.new("Really red")
			if player.TeamColor == BrickColor.new("Really red") then
				script.Disabled = true
				if player.TeamColor == BrickColor.new("White") then
					script.Disabled = false
				end				
			end			
		end		
	end)	
end

You could get the player by checking:

if game.Players:GetPlayerFromCharacter(touched.Parent) then

And then you can use that for your player variable instead. I don’t see much else that really has to change, as long as you use that for the player variable instead. Good luck :slight_smile:

for which line sorry, I’mreally dumb rn.

local Animation = game.Workspace.Animation

for Index, Part in pairs(Folder:GetChildren()) do
	Part.Touched:Connect(function(touched)
		if touched.Parent:FindFirstChild("Humanoid") then
			local AnimPlay = touched.Parent.Humanoid:LoadAnimation(Animation)
			touched.Parent.HumanoidRootPart.Anchored = true
			AnimPlay:Play()
			AnimPlay.Stopped:wait() --Waits until it finished playing
			touched.Parent.HumanoidRootPart.Anchored = false
			player.TeamColor = BrickColor.new("Really red")
			if player.TeamColor == BrickColor.new("Really red") then
				script.Disabled = true
				if player.TeamColor == BrickColor.new("White") then
					script.Disabled = false
				end				
			end			
		end		
	end)	
end

Actually nevermind, you don’t really need the player variable anyways.

using the script u sent am I able to make the script work in normal script?

You should use the Humanoid’s Animator, as the other guy mentioned in your other post about this same thing just now. My local script is taking over things - #11 by OIogist

1 Like

For the team color stuff, he probably does.

But this code has another problem:

That if statement is checking a variable that’s just been set, so it will always run, and likewise, the code inside the nested if statement will never run. I don’t know what your intended logic is, but I doubt it’s this.