The title says it all, it just won't work. Can someone please help me? The following script is a regular script inside the ServerScriptService. (And just in case, yes I am using R15)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		wait(2)
		local uis = game:GetService("UserInputService")
		local animation = Instance.new("Animation", workspace)
		animation.AnimationId = "rbxassetid://2405207143"
		local rstorage = game:GetService("ReplicatedStorage")
		local particles = rstorage:WaitForChild("ChargeParticles")
		local normalcharge = particles:WaitForChild("NormalCharge"):GetChildren()
		local char = player.Character
		local torso = player.Character:WaitForChild("UpperTorso")
		local chargeanimation = char.Humanoid:LoadAnimation(animation)
		uis.InputBegan:Connect(function(input,gameprocesed)
			if input.KeyCode == Enum.KeyCode.X then
				chargeanimation:Play()
				wait(.6)
				for _,v in pairs(normalcharge) do
					if v.Name == "Aura1" or v.Name == "Aura2" or v.Name == "Aura3" then
						v:Clone().Parent = torso
					end
				end
				
			end
		end)

		uis.InputEnded:Connect(function(input,gameprocesed)
			if input.KeyCode == Enum.KeyCode.X then
				chargeanimation:Stop()
				local removeparticles = torso:GetChildren()
				for _, v in pairs(removeparticles) do
					if v.Name == "Aura1" or v.Name == "Aura2" or v.Name == "Aura3" then
						v:Destroy()
					end
				end
			end
		end)
	end)
end)

2 comments

0

I don't get an error or anything, it just does nothing.

0

UserInputService should be handled on a local script.